mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
variant: make browser theme a css variable #494
This commit is contained in:
parent
2c14c6106a
commit
42fcbc3084
10 changed files with 20 additions and 31 deletions
|
@ -6,25 +6,21 @@ weight = 26
|
|||
|
||||
This interactive tool may help you to generate your own color variant stylesheet.
|
||||
|
||||
To get started, first select a color variant from the variant switch that fits you best as a starting point.
|
||||
{{% expand "Show usage instructions" %}}
|
||||
To get started, first select a color variant from the variant switch in the lower left sidebar that fits you best as a starting point.
|
||||
|
||||
The graph is interactive and reflect the current colors. You can click on any of the colored boxes to adjust the respective color. The graph and the page will update accordingly.
|
||||
The graph is interactive and reflect the current colors. You can click on any of the colored boxes to adjust the respective color. The graph **and the page** will update accordingly.
|
||||
|
||||
The arrowed lines reflects how colors are inherited thru different parts of the theme if the descendent isn't overwritten. If you want to delete a color and let it inherit from its parent, just delete the value from the input field.
|
||||
The arrowed lines reflect how colors are inherited thru different parts of the theme if the descendent isn't overwritten. If you want to delete a color and let it inherit from its parent, just delete the value from the input field.
|
||||
|
||||
To better understand this select the `neon` variant and modify the different heading colors. There, colors for the heading `h2`, `h3` and `h4` are explicitly set. `h5` is not set and inherits its value from `h4`. `h6` is also not set and inherits its value from `h5`.
|
||||
|
||||
Once you've changed a color, the variant switch will show a "My custom variant" entry and your changes are stored in the browser. You can change pages and even close the browser without losing your changes.
|
||||
Once you've changed a color, the variant switch will show a "My custom variant" entry and your changes are stored in the browser. You can **browse to other pages** and even close the browser **without losing your changes**.
|
||||
|
||||
Once you are satisfied, you can download the new variants file and copy it into your site's `static/css` directory. Afterwards you have to adjust the `themeVariant` parameter in your `config.toml` to your chosen file name.
|
||||
|
||||
Eg. if your new variants file is named `theme-my-custom-variant.css`, you have to set `themeVariant='my-custom-variant'` to use it.
|
||||
|
||||
{{% notice note %}}
|
||||
This only works in modern browsers.
|
||||
{{% /notice %}}
|
||||
|
||||
## Variant generator
|
||||
{{% /expand %}}
|
||||
|
||||
{{% button style="secondary" icon="download" href="javascript:window.variants&&variants.getStylesheet();this.blur();" %}}Download variant{{% /button %}}
|
||||
{{% button style="warning" icon="trash" href="javascript:window.variants&&variants.resetVariant();this.blur();" %}}Reset variant{{% /button %}}
|
||||
|
|
|
@ -205,6 +205,9 @@
|
|||
|
||||
/* ----------------------------------------------- */
|
||||
/* set default colors as in variant.css for IE11 */
|
||||
html {
|
||||
color-scheme: only light;
|
||||
}
|
||||
body {
|
||||
background-color: #ffffff; /* var(--MAIN-BG-color) */
|
||||
color: #101010; /* var(--MAIN-TEXT-color) */
|
||||
|
|
|
@ -47,7 +47,3 @@
|
|||
--BOX-BG-color: rgba( 255, 255, 255, .833 ); /* color of the content background */
|
||||
--BOX-TEXT-color: rgba( 16, 16, 16, 1 ); /* fixed color of the content text */
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: only light; /* set browser scrollbar color */
|
||||
}
|
||||
|
|
|
@ -48,10 +48,6 @@
|
|||
--BOX-TEXT-color: rgba( 16, 16, 16, 1 ); /* fixed color of the content text */
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: only light; /* set browser scrollbar color */
|
||||
}
|
||||
|
||||
body a#logo,
|
||||
body a#logo:hover,
|
||||
body #logo svg,
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
--CODE-INLINE-BG-color: #282a36; /* background color of inline code */
|
||||
--CODE-INLINE-BORDER-color: #464646; /* border color of inline code */
|
||||
|
||||
--BROWSER-theme: dark; /* name of the theme for browser scrollbars of the main section */
|
||||
--MERMAID-theme: dark; /* name of the default Mermaid theme for this variant, can be overridden in config.toml */
|
||||
--SWAGGER-theme: dark; /* name of the default Swagger theme for this variant, can be overridden in config.toml */
|
||||
|
||||
|
@ -70,10 +71,6 @@
|
|||
--BOX-RED-TEXT-color: var( --BOX-RED-color ); /* text color of red boxes */
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: only dark; /* set browser scrollbar color */
|
||||
}
|
||||
|
||||
body a#logo,
|
||||
body a#logo:hover,
|
||||
body #logo svg,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
--CODE-INLINE-BG-color: #fffae9; /* background color of inline code */
|
||||
--CODE-INLINE-BORDER-color: #f8e8c8; /* border color of inline code */
|
||||
|
||||
--BROWSER-theme: light; /* name of the theme for browser scrollbars of the main section */
|
||||
--MERMAID-theme: default; /* name of the default Mermaid theme for this variant, can be overridden in config.toml */
|
||||
--SWAGGER-theme: light; /* name of the default Swagger theme for this variant, can be overridden in config.toml */
|
||||
|
||||
|
@ -46,10 +47,6 @@
|
|||
--BOX-TEXT-color: rgba( 16, 16, 16, 1 ); /* text color of colored box content */
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: only light; /* set browser scrollbar color */
|
||||
}
|
||||
|
||||
body a#logo,
|
||||
body a#logo:hover,
|
||||
body #logo svg,
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
--CODE-INLINE-BG-color: #2d2d2d; /* background color of inline code */
|
||||
--CODE-INLINE-BORDER-color: #464646; /* border color of inline code */
|
||||
|
||||
--BROWSER-theme: dark; /* name of the theme for browser scrollbars of the main section */
|
||||
--MERMAID-theme: dark; /* name of the default Mermaid theme for this variant, can be overridden in config.toml */
|
||||
--SWAGGER-theme: dark; /* name of the default Swagger theme for this variant, can be overridden in config.toml */
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
--CODE-INLINE-BG-color: #fffae9; /* background color of inline code */
|
||||
--CODE-INLINE-BORDER-color: #f8e8c8; /* border color of inline code */
|
||||
|
||||
--BROWSER-theme: light; /* name of the theme for browser scrollbars of the main section */
|
||||
--MERMAID-theme: default; /* name of the default Mermaid theme for this variant, can be overridden in config.toml */
|
||||
--SWAGGER-theme: light; /* name of the default Swagger theme for this variant, can be overridden in config.toml */
|
||||
|
||||
|
@ -45,7 +46,3 @@
|
|||
--BOX-BG-color: rgba( 255, 255, 255, .833 ); /* background color of colored boxes */
|
||||
--BOX-TEXT-color: rgba( 16, 16, 16, 1 ); /* text color of colored box content */
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: only light; /* set browser scrollbar color */
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
--INTERNAL-CODE-font: var(--CODE-font, "Consolas", menlo, monospace);
|
||||
|
||||
--INTERNAL-BROWSER-theme: var(--BROWSER-theme, light);
|
||||
--INTERNAL-MERMAID-theme: var(--CONFIG-MERMAID-theme, var(--MERMAID-theme, var(--INTERNAL-PRINT-MERMAID-theme)));
|
||||
--INTERNAL-SWAGGER-theme: var(--CONFIG-SWAGGER-theme, var(--SWAGGER-theme, var(--INTERNAL-PRINT-SWAGGER-theme)));
|
||||
|
||||
|
@ -93,15 +94,19 @@
|
|||
--INTERNAL-BOX-WARNING-TEXT-color: var(--BOX-WARNING-TEXT-color, var(--INTERNAL-BOX-RED-TEXT-color));
|
||||
|
||||
/* print style, values taken from relearn-light as it is used as a default print style */
|
||||
--INTERNAL-PRINT-MERMAID-theme: var(--PRINT-MERMAID-theme, default);
|
||||
--INTERNAL-PRINT-MAIN-BG-color: var(--PRINT-MAIN-BG-color, #ffffff);
|
||||
--INTERNAL-PRINT-CODE-font: var(--PRINT-CODE-font, "Consolas", menlo, monospace);
|
||||
--INTERNAL-PRINT-TAG-BG-color: var(--PRINT-TAG-BG-color, #7dc903);
|
||||
--INTERNAL-PRINT-MAIN-font: var(--PRINT-MAIN-font, "Work Sans", "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif);
|
||||
--INTERNAL-PRINT-MAIN-TEXT-color: var(--PRINT-MAIN-TEXT-color, #101010);
|
||||
--INTERNAL-PRINT-MERMAID-theme: var(--PRINT-MERMAID-theme, default);
|
||||
--INTERNAL-PRINT-SWAGGER-theme: var(--PRINT-SWAGGER-theme, light);
|
||||
}
|
||||
|
||||
html {
|
||||
color-scheme: only var(--INTERNAL-BROWSER-theme);
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--INTERNAL-MAIN-BG-color);
|
||||
color: var(--INTERNAL-MAIN-TEXT-color);
|
||||
|
|
|
@ -575,6 +575,7 @@ var variants = {
|
|||
|
||||
{ name: 'CODE-font', group: 'code', default: '"Consolas", menlo, monospace', tooltip: 'text font of code', },
|
||||
|
||||
{ name: 'BROWSER-theme', group: '3rd party', default: 'light', tooltip: 'name of the theme for browser scrollbars of the main section', },
|
||||
{ name: 'MERMAID-theme', group: '3rd party', default: 'default', tooltip: 'name of the default Mermaid theme for this variant, can be overridden in config.toml', },
|
||||
{ name: 'SWAGGER-theme', group: '3rd party', default: 'light', tooltip: 'name of the default Swagger theme for this variant, can be overridden in config.toml', },
|
||||
|
||||
|
|
Loading…
Reference in a new issue