1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

add default_color_mode option

This commit is contained in:
checktheroads
2020-03-24 11:08:42 -07:00
parent 575af2d5da
commit 672cad2e47
7 changed files with 17 additions and 160 deletions

View File

@@ -2,7 +2,7 @@
id: ui
title: Web UI
sidebar_label: Web UI
keywords: [web ui, gui, theme, colors, branding]
keywords: [hyperglass, looking glass, web ui, gui, theme, colors, branding]
description: hyperglass Web UI Configuration
---
@@ -68,6 +68,7 @@ web:
title: hyperglass
title_mode: text_only
theme:
default_color_mode: light
colors:
black: "#262626"
blue: "#314cb6"
@@ -173,12 +174,20 @@ The `title_mode` parameter behaves in the following manner:
## `theme`
### Parameters
| Parameter | Type | Description |
| :------------------- | :----: | :----------------------------------------------------------------------------------------------------------------------------------------------- |
| `default_color_mode` | String | Sets the default color mode. Must be `light` or `dark`. If no default mode is specified, hyperglass will use the browser's preferred color mode. |
### Sections
| Section | Description | All Options |
| :------- | :----------- | :----------------------------------: |
| `colors` | Theme colors | <PageLink to="#colors">➡️</PageLink> |
| `fonts` | Theme fonts | <PageLink to="#fonts">➡️</PageLink> |
### `colors`
#### `colors`
| Parameter | Type | Default | Description |
| :---------- | :----: | :--------------------- | :------------------------------------- |
@@ -201,7 +210,7 @@ The `title_mode` parameter behaves in the following manner:
| `purple` | String | <Color hex="#8d30b5"/> | |
| `gray` | String | <Color hex="#c1c7cc"/> | |
### `fonts`
#### `fonts`
Currently, only [Google Fonts](https://fonts.google.com/) are supported.

View File

@@ -197,6 +197,7 @@ class Theme(HyperglassLevel3):
"""Validation model for theme variables."""
colors: ThemeColors = ThemeColors()
default_color_mode: Optional[constr(regex=r"light|dark")]
fonts: ThemeFonts = ThemeFonts()

View File

@@ -4,7 +4,7 @@ import sys
from datetime import datetime
__name__ = "hyperglass"
__version__ = "1.0.0-beta.9"
__version__ = "1.0.0-beta.10"
__author__ = "Matt Love"
__copyright__ = f"Copyright {datetime.now().year} Matthew Love"
__license__ = "BSD 3-Clause Clear License"

View File

@@ -1,153 +0,0 @@
---
# cache:
# database: 0
# host: localhost
# port: 6379
# show_text: true
# timeout: 120
# cors_origins: []
# debug: true
# developer_mode: false
# docs:
# base_url: https://lg.example.net
# description: ""
# devices:
# description: List of all devices/locations with associated identifiers, display names, networks, & VRFs.
# summary: Devices List
# title: Devices
# enable: true
# mode: redoc
# openapi_uri: /openapi.json
# queries:
# description: List of supported query types.
# summary: Query Types
# title: Supported Queries
# query:
# description: Request a query response per-location.
# summary: Query the Looking Glass
# title: Submit Query
# title: "{site_title} API Documentation"
# uri: /api/docs
# listen_address: 0.0.0.0
# listen_port: 8001
# log_file: /tmp/hyperglass_20204821-134836.log
# messages:
# acl_denied: "{target} is a member of {denied_network}, which is not allowed."
# acl_not_allowed: "{target} is not allowed."
# authentication_error: Authentication error occurred.
# connection_error: "Error connecting to {device_name}: {error}"
# feature_not_enabled: "{feature} is not enabled for {device_name}."
# general: Something went wrong.
# invalid_field: "{input} is an invalid {field}."
# invalid_input: "{target} is not a valid {query_type} target."
# no_input: "{field} must be specified."
# no_output: No output.
# no_response: No response.
# request_timeout: Request timed out.
# vrf_not_associated: VRF {vrf_name} is not associated with {device_name}.
# vrf_not_found: VRF {vrf_name} is not defined.
# org_name: Beloved Hyperglass User
# primary_asn: "65001"
# queries:
# bgp_aspath:
# display_name: BGP AS Path
# enable: true
# pattern:
# asdot: ^(\^|^\_)((\d+\.\d+)\_|(\d+\.\d+)\$|(\d+\.\d+)\(\_\.\+\_\))+$
# asplain: ^(\^|^\_)(\d+\_|\d+\$|\d+\(\_\.\+\_\))+$
# mode: asplain
# bgp_community:
# display_name: BGP Community
# enable: true
# pattern:
# decimal: ^[0-9]{1,10}$
# extended_as: ^([0-9]{0,5})\:([0-9]{1,5})$
# large: ^([0-9]{1,10})\:([0-9]{1,10})\:[0-9]{1,10}$
# bgp_route:
# display_name: BGP Route
# enable: true
# ping:
# display_name: Ping
# enable: true
# traceroute:
# display_name: Traceroute
# enable: true
# request_timeout: 30
# site_description: Beloved Hyperglass User Network Looking Glass
# site_keywords:
# - hyperglass
# - looking glass
# - lg
# - peer
# - peering
# - ipv4
# - ipv6
# - transit
# - community
# - communities
# - bgp
# - routing
# - network
# - isp
# site_title: hyperglass
# web:
# credit:
# enable: true
# dns_provider:
# name: google
# url: https://dns.google/resolve
# external_link:
# enable: true
# title: PeeringDB
# url: https://www.peeringdb.com/asn/{primary_asn}
# help_menu:
# enable: true
# file: null
# title: Help
# logo:
# dark: images/hyperglass-dark.png
# favicons: ui/images/favicons/
# height: null
# light: images/hyperglass-light.png
# width: 384
# opengraph:
# height: 1132
# image: images/hyperglass-opengraph.png
# width: 7355
# terms:
# enable: true
# file: null
# title: Terms
# text:
# cache: Results will be cached for 2 minutes.
# fqdn_tooltip: Use {protocol}
# query_location: Location
# query_target: Target
# query_type: Query Type
# query_vrf: Routing Table
# subtitle: AS65001
# title: hyperglass
# title_mode: logo_only
# theme:
# colors:
# black: "#262626"
# blue: "#314cb6"
# cyan: "#118ab2"
# danger: "#d84b4b"
# error: "#ff6b35"
# gray: "#c1c7cc"
# green: "#35b246"
# orange: "#ff6b35"
# pink: "#f2607d"
# primary: "#118ab2"
# purple: "#8d30b5"
# red: "#d84b4b"
# secondary: "#314cb6"
# success: "#35b246"
# teal: "#35b299"
# warning: "#edae49"
# white: "#f7f7f7"
# yellow: "#edae49"
# fonts:
# body: Nunito
# mono: Fira Code

View File

@@ -19,7 +19,7 @@ export const HyperglassProvider = ({ config, children }) => {
return (
<HyperglassContext.Provider value={value}>
<ThemeProvider theme={theme}>
<ColorModeProvider>
<ColorModeProvider value={config.web.theme.default_color_mode ?? null}>
<CSSReset />
<MediaProvider theme={theme}>{children}</MediaProvider>
</ColorModeProvider>

View File

@@ -2,7 +2,7 @@
set -e
HYPERGLASS_VERSION="1.0.0b9"
HYPERGLASS_VERSION="1.0.0b10"
MIN_PYTHON_MAJOR="3"
MIN_PYTHON_MINOR="6"

View File

@@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"
[tool.poetry]
name = "hyperglass"
version = "1.0.0-beta.9"
version = "1.0.0-beta.10"
description = "hyperglass is the modern network looking glass that tries to make the internet better."
authors = ["Matt Love <matt@hyperglass.io>"]
readme = "README.md"