From af45d7ea89bbdd3e40cd066462a68a7feb39f141 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Thu, 9 Feb 2023 11:52:53 +0000 Subject: [PATCH 01/64] :memo: Update file names in documentation --- docs/community/structure.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/community/structure.md b/docs/community/structure.md index 9bd143bcf..f16297169 100644 --- a/docs/community/structure.md +++ b/docs/community/structure.md @@ -9,14 +9,14 @@ The content is written in a combination of reStructuredText and MyST Markdown. ## Location and structure of CSS/JS assets The CSS and JS for this theme are built for the browser from `src/pydata_sphinx_theme/assets/*` with -[webpack](https://webpack.js.org/). The main entrypoints are: +[webpack](https://webpack.js.org/). The main entry points are: -- CSS: `src/pydata_sphinx_theme/assets/styles/index.scss` +- CSS: `src/pydata_sphinx_theme/assets/styles/pydata-sphinx-theme.scss` - the main part of the theme assets - customizes [Bootstrap](https://getbootstrap.com/) with [Sass](https://sass-lang.com) -- JS: `src/pydata_sphinx_theme/assets/scripts/index.js` +- JS: `src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js` - provides add-on Bootstrap features, as well as some custom navigation behavior From 63af29778386b2e780e39102227de09ff955a122 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 10 Feb 2023 16:53:49 +0000 Subject: [PATCH 02/64] :art: Update mixins to match new colour system --- .../assets/styles/variables/_color.scss | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 08ddb4d43..5e1e1abc3 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -78,24 +78,31 @@ $pst-semantic-colors: ( ), ); -/******************************************************************************* -* write the color rules for each theme (light/dark) -*/ +@mixin create-color-var($key, $value, $identifier: "") { + //$identifier is an optional variable - used for the new system + @if $identifier != "" { + --pst-color-#{$key}-#{$identifier}: #{$value}; + } @else { + --pst-color-#{$key}: #{$value}; + } +} -/* NOTE: - * Mixins enable us to reuse the same definitions for the different modes - * https://sass-lang.com/documentation/at-rules/mixin - * #{...} inserts a variable into a CSS selector or property name - * https://sass-lang.com/documentation/interpolation - */ @mixin theme-colors($mode) { - // check if this color is defined differently for light/dark @each $name, $value in $pst-semantic-colors { + // check if there is a map (i.e. multiple light/dark definitions) @if type-of($value) == map { - $value: map-get($value, $mode); - } - & { - --pst-color-#{$name}: #{$value}; + // support for single light/dark colour definitions + @if map-has-key($value, $mode) { + $value: map-get($value, $mode); + @include create-color-var($name, $value); + } // support for multiple light/dark colour definitions - as our new design system + @else { + @each $key, $val in $value { + @include create-color-var($key, $val, $name); + } + } + } @else { + @include create-color-var($name, $value); } } // assign the "duplicate" colors (ones that just reference other variables) From 06ad7370e9fa5fb739ad0701a11306f92046ddc2 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 10 Feb 2023 18:20:26 +0000 Subject: [PATCH 03/64] :wheelchair: Update colours --- .../assets/styles/variables/_color.scss | 62 ++++++++++++++++--- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 5e1e1abc3..c14c94e5c 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -5,21 +5,63 @@ * NOTE: this theme defines "info == primary" and "warning == secondary" */ $pst-semantic-colors: ( - "primary": rgb(69, 157, 185), - "secondary": rgb(238, 144, 64), - "info": rgb(69, 157, 185), - "warning": rgb(238, 144, 64), + "primary": ( + //WCAG AA compliant against dark bg + "50": #f4fbfc, + "100": #e9f6f8, + "200": #d0ecf1, + "300": #abdde6, + "400": #3fb1c5, + //WCAG AA compliant against light bg + "500": #0a7d91, + "600": #085d6c, + "700": #064752, + "800": #042c33, + "900": #021b1f, + ), + "secondary": ( + //WCAG AA compliant against dark bg + "50": #fbf8fe, + "100": #f6f2fe, + "200": #ece3fc, + "300": #decdfa, + "400": #b691f5, + //WCAG AA compliant against light bg + "500": #894def, + "600": #6730c5, + "700": #4e2595, + "800": #31175f, + "900": #1e0e39, + ), + "info": ( + "light": #276be9, + "light-bg": #eff4fd, + "dark": #79a3f2, + "dark-bg": #06245d, + ), + "warning": ( + "light": #f66a0a, + "light-bg": #fff8f2, + "dark": #ff9245, + "dark-bg": #652a02, + ), "success": ( - "light": rgb(40, 167, 69), - "dark": rgb(72, 135, 87), + "light": #00843f, + "light-bg": #ecf6f1, + "dark": #5fb488, + "dark-bg": #002f17, ), "attention": ( - "light": rgb(255, 193, 7), - "dark": rgb(220, 169, 15), + "light": #f66a0a, + "light-bg": #fff8f2, + "dark": #ff9245, + "dark-bg": #652a02, ), "danger": ( - "light": rgb(220, 53, 69), - "dark": rgb(203, 70, 83), + "light": #d72d47, + "light-bg": #fcf1f2, + "dark": #e78894, + "dark-bg": #4e111b, ), "text-base": ( "light": rgb(50, 50, 50), From 74c2eeadffa6d859ade9ebd7eb8f3eafa550da78 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 10 Feb 2023 19:00:52 +0000 Subject: [PATCH 04/64] :wheelchair: Update foundation and text colours --- .../styles/extensions/_sphinx_design.scss | 3 +- .../assets/styles/variables/_color.scss | 69 +++++++++++-------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index f73bd1d86..11d7509ac 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -53,7 +53,8 @@ $extra-semantic-colors: ( "dark": map-get($pst-semantic-colors, "text-base"), "muted": map-get($pst-semantic-colors, "text-muted"), "light": rgb(201, 201, 201), - "black": rgb(0, 0, 0), + "black": hsl(216, 20%, 10%), + //gray-900 "white": rgb(255, 255, 255), ); diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index c14c94e5c..e8073cda1 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -64,55 +64,68 @@ $pst-semantic-colors: ( "dark-bg": #4e111b, ), "text-base": ( - "light": rgb(50, 50, 50), - // Black + 50 - "dark": rgb(206, 206, 206), - // White - 50 + "light": rgb(34, 40, 50), + // gray-800 + // "dark": #e5e7ea + "dark": #ced6dd, + // gray-100 ), "text-muted": ( - "light": rgb(100, 100, 100), - // Twice as far from 0 as base - "dark": rgb(166, 166, 166), - // Twice as far from 256 as base - ), - "shadow": ( - "light": rgb(216, 216, 216), - "dark": rgb(33, 33, 33), - ), - "border": ( - "light": rgb(201, 201, 201), - "dark": rgb(192, 192, 192), - ), - "inline-code": ( - "light": rgb(232, 62, 140), - "dark": rgb(221, 158, 194), - ), - "target": ( - "light": rgb(251, 229, 78), - "dark": rgb(71, 39, 0), + "light": #48566b, + // gray-600 + "dark": #d1d5da, + // gray-300 ), + // TODO - update + "shadow": + ( + "light": rgb(216, 216, 216), + "dark": rgb(33, 33, 33), + ), + // TODO- update + "border": + ( + "light": rgb(201, 201, 201), + "dark": rgb(192, 192, 192), + ), + // TODO - update + "inline-code": + ( + "light": rgb(232, 62, 140), + "dark": rgb(221, 158, 194), + ), + // TODO - update + "target": + ( + "light": rgb(251, 229, 78), + "dark": rgb(71, 39, 0), + ), // DEPTH COLORS // background: color of the canvas / the furthest back layer "background": ( "light": rgb(255, 255, 255), - "dark": rgb(18, 18, 18), + "dark": #14181e, ), // on-background: provides slight contrast against background // (by use of shadows in light theme) "on-background": ( "light": rgb(255, 255, 255), - "dark": rgb(30, 30, 30), + "dark": #222832, + // gray-800 ), // surface: object set above the background (without shadows) // Uses JupyterLab cell background colors in light/dark theme "surface": ( - "light": rgb(245, 245, 245), - "dark": rgb(33, 33, 33), + "light": #f3f4f5, + // gray-100 + "dark": #364150, + // gray-700 ), // on_surface: object on top of surface object (without shadows) + //TODO - update "on-surface": ( "light": rgb(225, 225, 225), From 722f4d50be2a1cf679d094f89acfb8acfd2894c3 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 13 Feb 2023 12:11:51 +0000 Subject: [PATCH 05/64] Add more colours - shadows and neutrals --- .../assets/styles/variables/_color.scss | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index e8073cda1..7e51b78fa 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -79,14 +79,15 @@ $pst-semantic-colors: ( // TODO - update "shadow": ( - "light": rgb(216, 216, 216), - "dark": rgb(33, 33, 33), + // "light": rgb(216, 216, 216), + "light": rgba(0, 0, 0, 0.1), + "dark": rgba(0, 0, 0, 0.2), ), - // TODO- update + // TODO- update (need muted and regular - this is muted) "border": ( - "light": rgb(201, 201, 201), - "dark": rgb(192, 192, 192), + "light": rgba(23, 23, 26, 0.2), + "dark": #48566b, ), // TODO - update "inline-code": From fbe4f35d1552ce208b224c941eeeccc26ba92b82 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 13 Feb 2023 13:08:12 +0000 Subject: [PATCH 06/64] :wheelchair: Replace text colour function w/WCAG one --- .../styles/extensions/_sphinx_design.scss | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 11d7509ac..12596e103 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -16,12 +16,12 @@ * https://github.com/executablebooks/sphinx-design/blob/9226a12a/style/_colors.scss#L31-L43 */ $sd-semantic-color-names: ( - "primary", - "secondary", - "success", - "info", - "warning", - "danger", + // "primary", + // "secondary", + // "success", + // "info", + // "warning", + // "danger", "light", "muted", "dark", @@ -33,8 +33,17 @@ $sd-semantic-color-names: ( * function, to make sure that text is legible on colored buttons and badges. * https://github.com/executablebooks/sphinx-design/blob/9226a12a/style/_colors.scss#L45-L47 */ + @function text-color($value) { - @return if(lightness($value) > 70, #000, #fff); + // Using WCAG luminance formula https://www.w3.org/TR/WCAG20/#relativeluminancedef + // this function will return text-colour that would meet WCAG AA contrast ratio + $luminance: (0.2126 * red($value)) + (0.7152 * green($value)) + + (0.0722 * blue($value)); + @return if( + $luminance >= 0.1791, + "var(--pst-color-black)", + "var(--pst-color-black)" + ); } /** @@ -71,11 +80,14 @@ $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); } // define the pst variables, so that downstream user overrides will work --pst-color-#{$name}: #{$value}; + // TODO: update to allow for new scheme --pst-color-#{$name}-text: #{text-color($value)}; + // TODO: check where highlight is used --pst-color-#{$name}-highlight: #{darken($value, 15%)}; // override the sphinx-design variables --sd-color-#{$name}: var(--pst-color-#{$name}); --sd-color-#{$name}-text: var(--pst-color-#{$name}-text); + // TODO: check where highlight is used --sd-color-#{$name}-highlight: var(--pst-color-#{$name}-highlight); } } From 4e71156a04e1f7ad3072669c302a4c122b3ca3d9 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 13 Feb 2023 16:40:43 +0000 Subject: [PATCH 07/64] :recycle: Add full color system to root --- .../assets/styles/variables/_color.scss | 84 +++++++++++++++++-- 1 file changed, 77 insertions(+), 7 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 7e51b78fa..c3ff7ba82 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -2,8 +2,80 @@ * master color map. Only the colors that actually differ between light and dark * themes are specified separately. * -* NOTE: this theme defines "info == primary" and "warning == secondary" */ + +/* PyData theme - adaptive color scheme */ +/* These are the base colors for the PyData Sphinx theme */ +$theme-colors: ( + // Primary color + "light-blue": + ( + "50": #f4fbfc, + "100": #e9f6f8, + "200": #d0ecf1, + "300": #abdde6, + "400": #3fb1c5, + "500": #0a7d91, + "600": #085d6c, + "700": #064752, + "800": #042c33, + "900": #021b1f, + ), + // Secondary color + "violet": + ( + "50": #fbf8fe, + "100": #f6f2fe, + "200": #ece3fc, + "300": #decdfa, + "400": #b691f5, + "500": #894def, + "600": #6730c5, + "700": #4e2595, + "800": #31175f, + "900": #1e0e39, + ), + // Neutrals + "gray": + ( + "50": #f9f9fa, + "100": #f3f4f5, + "200": #e5e7ea, + "300": #d1d5da, + "400": #9ca4af, + "500": #677384, + "600": #48566b, + "700": #364150, + "800": #222832, + "900": #14181e, + ), + // Accent color + "pink": + ( + "50": #fcf8fd, + "100": #fcf0fa, + "200": #f8dff5, + "300": #f3c7ee, + "400": #e47fd7, + "500": #c132af, + "600": #912583, + "700": #6e1c64, + "800": #46123f, + "900": #2b0b27, + ) +); + +:root { + @each $group-color, $color in $theme-colors { + @each $color-name, $value in $color { + --pst-#{$group-color}-#{$color-name}: #{$value}; + } + } + // Foundation colors + --pst-color-white: #ffffff; + --pst-color-black: var(--pst-gray-900); +} + $pst-semantic-colors: ( "primary": ( //WCAG AA compliant against dark bg @@ -89,12 +161,10 @@ $pst-semantic-colors: ( "light": rgba(23, 23, 26, 0.2), "dark": #48566b, ), - // TODO - update - "inline-code": - ( - "light": rgb(232, 62, 140), - "dark": rgb(221, 158, 194), - ), + "inline-code": ( + "light": var(--pydata-pink-400), + "dark": var(--pydata-pink-500), + ), // TODO - update "target": ( From e072eb19a2b373200fe7c2a4ea03f383f89a6134 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 13 Feb 2023 16:48:11 +0000 Subject: [PATCH 08/64] :wheelchair: Update variables - use color names --- .../assets/styles/variables/_color.scss | 52 +++++-------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index c3ff7ba82..b5005ae9f 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -78,32 +78,12 @@ $theme-colors: ( $pst-semantic-colors: ( "primary": ( - //WCAG AA compliant against dark bg - "50": #f4fbfc, - "100": #e9f6f8, - "200": #d0ecf1, - "300": #abdde6, - "400": #3fb1c5, - //WCAG AA compliant against light bg - "500": #0a7d91, - "600": #085d6c, - "700": #064752, - "800": #042c33, - "900": #021b1f, + light: var(--pst-light-blue-500), + dark: var(--pst-light-blue-400), ), "secondary": ( - //WCAG AA compliant against dark bg - "50": #fbf8fe, - "100": #f6f2fe, - "200": #ece3fc, - "300": #decdfa, - "400": #b691f5, - //WCAG AA compliant against light bg - "500": #894def, - "600": #6730c5, - "700": #4e2595, - "800": #31175f, - "900": #1e0e39, + light: var(--pst-violet-500), + dark: var(--pst-violet-400), ), "info": ( "light": #276be9, @@ -136,17 +116,14 @@ $pst-semantic-colors: ( "dark-bg": #4e111b, ), "text-base": ( - "light": rgb(34, 40, 50), - // gray-800 + "light": var(--pst-gray-800), // "dark": #e5e7ea "dark": #ced6dd, // gray-100 ), "text-muted": ( - "light": #48566b, - // gray-600 - "dark": #d1d5da, - // gray-300 + "light": var(--pst-gray-600), + "dark": var(--pst-gray-300), ), // TODO - update "shadow": @@ -175,25 +152,22 @@ $pst-semantic-colors: ( // background: color of the canvas / the furthest back layer "background": ( - "light": rgb(255, 255, 255), - "dark": #14181e, + "light": var(--pst-color-white), + "dark": var(--pst-color-black), ), // on-background: provides slight contrast against background // (by use of shadows in light theme) "on-background": ( - "light": rgb(255, 255, 255), - "dark": #222832, - // gray-800 + "light": var(--pst-color-white), + "dark": var(--pst-color-gray-800), ), // surface: object set above the background (without shadows) // Uses JupyterLab cell background colors in light/dark theme "surface": ( - "light": #f3f4f5, - // gray-100 - "dark": #364150, - // gray-700 + "light": var(--pst-gray-100), + "dark": var(--pst-gray-700), ), // on_surface: object on top of surface object (without shadows) //TODO - update From 884b8225c7798919c752ef4cc10022a95b554bf4 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 14 Feb 2023 12:53:01 +0000 Subject: [PATCH 09/64] :wheelchair: Ensure all the colours are evaluated correctly --- .../assets/styles/variables/_color.scss | 87 ++++++++++++------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index b5005ae9f..9023e3c7a 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -2,10 +2,10 @@ * master color map. Only the colors that actually differ between light and dark * themes are specified separately. * +* To see the full list of colors see https://www.figma.com/file/rUrrHGhUBBIAAjQ82x6pz9/PyData-Design-system---proposal-for-implementation-(2)?node-id=1234%3A765&t=ifcFT1JtnrSshGfi-1 */ -/* PyData theme - adaptive color scheme */ -/* These are the base colors for the PyData Sphinx theme */ +/* Assign base colors for the PyData theme */ $theme-colors: ( // Primary color "light-blue": @@ -62,28 +62,52 @@ $theme-colors: ( "700": #6e1c64, "800": #46123f, "900": #2b0b27, - ) + ), + "foundation": ( + "white": #ffffff, + "black": #14181e, + ) ); -:root { +html { + // Add theme colours to the html element @each $group-color, $color in $theme-colors { @each $color-name, $value in $color { --pst-#{$group-color}-#{$color-name}: #{$value}; } } - // Foundation colors - --pst-color-white: #ffffff; - --pst-color-black: var(--pst-gray-900); + + // Minimum contrast ratio used for the theme. + // Acceptable values for WCAG 2.0 are 3, 4.5 and 7. + // See https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast + $min-contrast-ratio: 4.5; + + // Customize the light and dark text colors for use in our color contrast function. + $color-contrast-dark: #{pst-color-black}; + $color-contrast-light: #{pst-color-white}; +} + +/** +* Function to get items from nested maps +*/ +// @param {Map} $map - Map +// @param {Arglist} $keys - Keys to fetch +// @return {*} +@function map-deep-get($map, $keys...) { + @each $key in $keys { + $map: map-get($map, $key); + } + @return $map; } $pst-semantic-colors: ( "primary": ( - light: var(--pst-light-blue-500), - dark: var(--pst-light-blue-400), + light: #{map-deep-get($theme-colors, "light-blue", "500")}, + dark: #{map-deep-get($theme-colors, "light-blue", "400")}, ), "secondary": ( - light: var(--pst-violet-500), - dark: var(--pst-violet-400), + light: #{map-deep-get($theme-colors, "violet", "500")}, + dark: #{map-deep-get($theme-colors, "violet", "400")}, ), "info": ( "light": #276be9, @@ -116,14 +140,14 @@ $pst-semantic-colors: ( "dark-bg": #4e111b, ), "text-base": ( - "light": var(--pst-gray-800), + "light": #{map-deep-get($theme-colors, "gray", "800")}, // "dark": #e5e7ea "dark": #ced6dd, // gray-100 ), "text-muted": ( - "light": var(--pst-gray-600), - "dark": var(--pst-gray-300), + "light": #{map-deep-get($theme-colors, "gray", "600")}, + "dark": #{map-deep-get($theme-colors, "gray", "300")}, ), // TODO - update "shadow": @@ -136,45 +160,42 @@ $pst-semantic-colors: ( "border": ( "light": rgba(23, 23, 26, 0.2), - "dark": #48566b, + "dark": #{map-deep-get($theme-colors, "gray", "600")}, ), "inline-code": ( - "light": var(--pydata-pink-400), - "dark": var(--pydata-pink-500), + "light": #{map-deep-get($theme-colors, "pink", "600")}, + "dark": #{map-deep-get($theme-colors, "pink", "300")}, + ), + "target": ( + "light": #8b6e31, + "dark": #c79d41, ), - // TODO - update - "target": - ( - "light": rgb(251, 229, 78), - "dark": rgb(71, 39, 0), - ), // DEPTH COLORS // background: color of the canvas / the furthest back layer "background": ( - "light": var(--pst-color-white), - "dark": var(--pst-color-black), + "light": #{map-deep-get($theme-colors, "foundation", "white")}, + "dark": #{map-deep-get($theme-colors, "foundation", "black")}, ), // on-background: provides slight contrast against background // (by use of shadows in light theme) "on-background": ( - "light": var(--pst-color-white), - "dark": var(--pst-color-gray-800), + "light": #{map-deep-get($theme-colors, "foundation", "white")}, + "dark": #{map-deep-get($theme-colors, "gray", "800")}, ), // surface: object set above the background (without shadows) // Uses JupyterLab cell background colors in light/dark theme "surface": ( - "light": var(--pst-gray-100), - "dark": var(--pst-gray-700), + "light": #{map-deep-get($theme-colors, "gray", "100")}, + "dark": #{map-deep-get($theme-colors, "gray", "700")}, ), // on_surface: object on top of surface object (without shadows) - //TODO - update "on-surface": ( - "light": rgb(225, 225, 225), - "dark": rgb(55, 55, 55), + "light": #{map-deep-get($theme-colors, "gray", "800")}, + "dark": #ced6dd, ), ); @@ -208,7 +229,7 @@ $pst-semantic-colors: ( // assign the "duplicate" colors (ones that just reference other variables) & { --pst-color-link: var(--pst-color-primary); - --pst-color-link-hover: var(--pst-color-warning); + --pst-color-link-hover: var(--pst-color-secondary); } // adapt to light/dark-specific content @if $mode == "light" { From d520b728c839376a5372f155035a8a8a493a3488 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 14 Feb 2023 20:39:34 +0000 Subject: [PATCH 10/64] Update mixins - move to separate file --- .../assets/styles/abstracts/_mixins.scss | 102 ++++++++++++++++++ .../assets/styles/variables/_color.scss | 16 ++- 2 files changed, 108 insertions(+), 10 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index 47fc9ed28..a56f59762 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -71,6 +71,26 @@ } } +/** + * Assign the admonition colours from our variables + */ +@mixin assign-background-color($color-variable) { + &:before { + content: ""; + width: 100%; + height: 100%; + position: absolute; + left: 0; + top: 0; + background-color: var(#{$color-variable}-bg); + + // So that hovering over the text within background is still possible. + // Otherwise the background overlays the text and you cannot click or select easily. + // ref: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events + pointer-events: none; + } +} + /** * Set background of some cell outputs to white-ish to make sure colors work * This is because many libraries make output that only looks good on white @@ -81,3 +101,85 @@ border-radius: 0.25rem; padding: 0.5rem; } + +/** +* Function to calculate the contrast ratio between two colors - this is used to +* determine the best color to use for text on a given background color. For example, +* for buttons. +*/ +@function color-contrast( + $background, + $color-contrast-dark: $color-contrast-dark, + $color-contrast-light: $color-contrast-light, + $min-contrast-ratio: $min-contrast-ratio +) { + $foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black; + $max-ratio: 0; + $max-ratio-color: null; + + @each $color in $foregrounds { + $contrast-ratio: contrast-ratio($background, $color); + @if $contrast-ratio > $min-contrast-ratio { + @return $color; + } @else if $contrast-ratio > $max-ratio { + $max-ratio: $contrast-ratio; + $max-ratio-color: $color; + } + } + + @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}..."; + + @return $max-ratio-color; +} + +// Return WCAG2.1 relative luminance +// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance +// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio +@function luminance($color) { + $rgb: ( + "r": red($color), + "g": green($color), + "b": blue($color), + ); + + @each $name, $value in $rgb { + $value: if( + divide($value, 255) < 0.04045, + divide(divide($value, 255), 12.92), + nth($_luminance-list, $value + 1) + ); + $rgb: map-merge( + $rgb, + ( + $name: $value, + ) + ); + } + + @return (map-get($rgb, "r") * 0.2126) + (map-get($rgb, "g") * 0.7152) + + (map-get($rgb, "b") * 0.0722); +} + +@function contrast-ratio($background, $foreground: $color-contrast-light) { + $l1: luminance($background); + $l2: luminance(opaque($background, $foreground)); + + @return if( + $l1 > $l2, + divide($l1 + 0.05, $l2 + 0.05), + divide($l2 + 0.05, $l1 + 0.05) + ); +} + +/** +* Function to get items from nested maps +*/ +// @param {Map} $map - Map +// @param {Arglist} $keys - Keys to fetch +// @return {*} +@function map-deep-get($map, $keys...) { + @each $key in $keys { + $map: map-get($map, $key); + } + @return $map; +} diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 9023e3c7a..6b3063dce 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -69,7 +69,7 @@ $theme-colors: ( ) ); -html { +:root { // Add theme colours to the html element @each $group-color, $color in $theme-colors { @each $color-name, $value in $color { @@ -111,6 +111,7 @@ $pst-semantic-colors: ( ), "info": ( "light": #276be9, + // TODO: update this to passs the bg colours "light-bg": #eff4fd, "dark": #79a3f2, "dark-bg": #06245d, @@ -141,21 +142,16 @@ $pst-semantic-colors: ( ), "text-base": ( "light": #{map-deep-get($theme-colors, "gray", "800")}, - // "dark": #e5e7ea "dark": #ced6dd, - // gray-100 ), "text-muted": ( "light": #{map-deep-get($theme-colors, "gray", "600")}, "dark": #{map-deep-get($theme-colors, "gray", "300")}, ), - // TODO - update - "shadow": - ( - // "light": rgb(216, 216, 216), - "light": rgba(0, 0, 0, 0.1), - "dark": rgba(0, 0, 0, 0.2), - ), + "shadow": ( + "light": rgba(0, 0, 0, 0.1), + "dark": rgba(0, 0, 0, 0.2), + ), // TODO- update (need muted and regular - this is muted) "border": ( From c4f9894a0c917ce85833b38de7ac57beddbf7749 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Sun, 19 Feb 2023 16:55:13 +0000 Subject: [PATCH 11/64] Update contrast ratios - add comments --- .../assets/styles/variables/_color.scss | 48 ++++++++----------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 6b3063dce..ec75f0e1c 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -80,6 +80,9 @@ $theme-colors: ( // Minimum contrast ratio used for the theme. // Acceptable values for WCAG 2.0 are 3, 4.5 and 7. // See https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast + // 4.5 - is for text that is 14pt or less + $min-contrast-ratio-text: 4.5; + // 3 is for text that is 18pt or bold, or for non-text elements $min-contrast-ratio: 4.5; // Customize the light and dark text colors for use in our color contrast function. @@ -166,7 +169,8 @@ $pst-semantic-colors: ( "light": #8b6e31, "dark": #c79d41, ), - // DEPTH COLORS + // DEPTH COLORS - you can see the elevation colours and shades + // in the Figma file https://www.figma.com/file/rUrrHGhUBBIAAjQ82x6pz9/PyData-Design-system---proposal-for-implementation-(2)?node-id=1492%3A922&t=sQeQZehkOzposYEg-1 // background: color of the canvas / the furthest back layer "background": ( @@ -180,13 +184,10 @@ $pst-semantic-colors: ( "light": #{map-deep-get($theme-colors, "foundation", "white")}, "dark": #{map-deep-get($theme-colors, "gray", "800")}, ), - // surface: object set above the background (without shadows) - // Uses JupyterLab cell background colors in light/dark theme - "surface": - ( - "light": #{map-deep-get($theme-colors, "gray", "100")}, - "dark": #{map-deep-get($theme-colors, "gray", "700")}, - ), + "surface": ( + "light": #{map-deep-get($theme-colors, "gray", "100")}, + "dark": #{map-deep-get($theme-colors, "gray", "700")}, + ), // on_surface: object on top of surface object (without shadows) "on-surface": ( @@ -195,32 +196,23 @@ $pst-semantic-colors: ( ), ); -@mixin create-color-var($key, $value, $identifier: "") { - //$identifier is an optional variable - used for the new system - @if $identifier != "" { - --pst-color-#{$key}-#{$identifier}: #{$value}; - } @else { - --pst-color-#{$key}: #{$value}; - } -} - @mixin theme-colors($mode) { + // check if this color is defined differently for light/dark @each $name, $value in $pst-semantic-colors { - // check if there is a map (i.e. multiple light/dark definitions) + @debug "name: #{$name}"; @if type-of($value) == map { - // support for single light/dark colour definitions - @if map-has-key($value, $mode) { - $value: map-get($value, $mode); - @include create-color-var($name, $value); - } // support for multiple light/dark colour definitions - as our new design system - @else { - @each $key, $val in $value { - @include create-color-var($key, $val, $name); + @each $key, $val in $value { + // since now we define the bg colours in the semantic colours and not + // by changing opacity, we need to check if the key contains bg + @if (str-index($key, "bg")) != null { + @debug "key: #{$key}"; + @debug "val: #{$val}"; + --pst-color-#{$key}: #{$val}; } } - } @else { - @include create-color-var($name, $value); + $value: map-get($value, $mode); } + --pst-color-#{$name}: #{$value}; } // assign the "duplicate" colors (ones that just reference other variables) & { From fe6fe763570de27723bbf99a847237da26f407c4 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Sun, 19 Feb 2023 17:33:48 +0000 Subject: [PATCH 12/64] =?UTF-8?q?=E2=99=BF=EF=B8=8F=20=20Add=20luminance?= =?UTF-8?q?=20formula=20and=20ignore=20text=20col=20for=20now?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/styles/abstracts/_mixins.scss | 69 -------- .../styles/extensions/_sphinx_design.scss | 154 ++++++++++++++---- .../assets/styles/variables/_color.scss | 56 +++---- 3 files changed, 151 insertions(+), 128 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index a56f59762..ca8e17096 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -102,75 +102,6 @@ padding: 0.5rem; } -/** -* Function to calculate the contrast ratio between two colors - this is used to -* determine the best color to use for text on a given background color. For example, -* for buttons. -*/ -@function color-contrast( - $background, - $color-contrast-dark: $color-contrast-dark, - $color-contrast-light: $color-contrast-light, - $min-contrast-ratio: $min-contrast-ratio -) { - $foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black; - $max-ratio: 0; - $max-ratio-color: null; - - @each $color in $foregrounds { - $contrast-ratio: contrast-ratio($background, $color); - @if $contrast-ratio > $min-contrast-ratio { - @return $color; - } @else if $contrast-ratio > $max-ratio { - $max-ratio: $contrast-ratio; - $max-ratio-color: $color; - } - } - - @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}..."; - - @return $max-ratio-color; -} - -// Return WCAG2.1 relative luminance -// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance -// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio -@function luminance($color) { - $rgb: ( - "r": red($color), - "g": green($color), - "b": blue($color), - ); - - @each $name, $value in $rgb { - $value: if( - divide($value, 255) < 0.04045, - divide(divide($value, 255), 12.92), - nth($_luminance-list, $value + 1) - ); - $rgb: map-merge( - $rgb, - ( - $name: $value, - ) - ); - } - - @return (map-get($rgb, "r") * 0.2126) + (map-get($rgb, "g") * 0.7152) + - (map-get($rgb, "b") * 0.0722); -} - -@function contrast-ratio($background, $foreground: $color-contrast-light) { - $l1: luminance($background); - $l2: luminance(opaque($background, $foreground)); - - @return if( - $l1 > $l2, - divide($l1 + 0.05, $l2 + 0.05), - divide($l2 + 0.05, $l1 + 0.05) - ); -} - /** * Function to get items from nested maps */ diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 12596e103..2dac34e30 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -7,6 +7,7 @@ */ @use "../variables/color" as *; +@use "sass:color" as color; /******************************************************************************* * Color and variables @@ -16,12 +17,12 @@ * https://github.com/executablebooks/sphinx-design/blob/9226a12a/style/_colors.scss#L31-L43 */ $sd-semantic-color-names: ( - // "primary", - // "secondary", - // "success", - // "info", - // "warning", - // "danger", + "primary", + "secondary", + "success", + "info", + "warning", + "danger", "light", "muted", "dark", @@ -29,20 +30,110 @@ $sd-semantic-color-names: ( "white" ); -/* Here we incorporate a modified version of sphinx-design's text-color - * function, to make sure that text is legible on colored buttons and badges. - * https://github.com/executablebooks/sphinx-design/blob/9226a12a/style/_colors.scss#L45-L47 - */ +// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255) +$_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 + 0.0027 0.003 0.0033 0.0037 0.004 0.0044 0.0048 0.0052 0.0056 0.006 0.0065 + 0.007 0.0075 0.008 0.0086 0.0091 0.0097 0.0103 0.011 0.0116 0.0123 0.013 + 0.0137 0.0144 0.0152 0.016 0.0168 0.0176 0.0185 0.0194 0.0203 0.0212 0.0222 + 0.0232 0.0242 0.0252 0.0262 0.0273 0.0284 0.0296 0.0307 0.0319 0.0331 0.0343 + 0.0356 0.0369 0.0382 0.0395 0.0409 0.0423 0.0437 0.0452 0.0467 0.0482 0.0497 + 0.0513 0.0529 0.0545 0.0561 0.0578 0.0595 0.0612 0.063 0.0648 0.0666 0.0685 + 0.0704 0.0723 0.0742 0.0762 0.0782 0.0802 0.0823 0.0844 0.0865 0.0887 0.0908 + 0.0931 0.0953 0.0976 0.0999 0.1022 0.1046 0.107 0.1095 0.1119 0.1144 0.117 + 0.1195 0.1221 0.1248 0.1274 0.1301 0.1329 0.1356 0.1384 0.1413 0.1441 0.147 + 0.15 0.1529 0.1559 0.159 0.162 0.1651 0.1683 0.1714 0.1746 0.1779 0.1812 + 0.1845 0.1878 0.1912 0.1946 0.1981 0.2016 0.2051 0.2086 0.2122 0.2159 0.2195 + 0.2232 0.227 0.2307 0.2346 0.2384 0.2423 0.2462 0.2502 0.2542 0.2582 0.2623 + 0.2664 0.2705 0.2747 0.2789 0.2831 0.2874 0.2918 0.2961 0.3005 0.305 0.3095 + 0.314 0.3185 0.3231 0.3278 0.3325 0.3372 0.3419 0.3467 0.3515 0.3564 0.3613 + 0.3663 0.3712 0.3763 0.3813 0.3864 0.3916 0.3968 0.402 0.4072 0.4125 0.4179 + 0.4233 0.4287 0.4342 0.4397 0.4452 0.4508 0.4564 0.4621 0.4678 0.4735 0.4793 + 0.4851 0.491 0.4969 0.5029 0.5089 0.5149 0.521 0.5271 0.5333 0.5395 0.5457 + 0.552 0.5583 0.5647 0.5711 0.5776 0.5841 0.5906 0.5972 0.6038 0.6105 0.6172 + 0.624 0.6308 0.6376 0.6445 0.6514 0.6584 0.6654 0.6724 0.6795 0.6867 0.6939 + 0.7011 0.7084 0.7157 0.7231 0.7305 0.7379 0.7454 0.7529 0.7605 0.7682 0.7758 + 0.7835 0.7913 0.7991 0.807 0.8148 0.8228 0.8308 0.8388 0.8469 0.855 0.8632 + 0.8714 0.8796 0.8879 0.8963 0.9047 0.9131 0.9216 0.9301 0.9387 0.9473 0.956 + 0.9647 0.9734 0.9823 0.9911 1; + +@function a11y-combination( + $bg, + $target-color-contrast-dark: $foundation-black, + $target-color-contrast-light: $base-light-text, + $target-color-contrast-white: $foundation-white, + $min-contrast-ratio: $min-contrast-ratio +) { + // will test against our two base foreground colors + $foregrounds: $target-color-contrast-light, $target-color-contrast-dark; + $max-ratio: 0; + $max-ratio-color: null; + + @debug "Using AA #{$min-contrast-ratio}:1 contrast ratio for #{$bg} ♿️"; + @each $fg in $foregrounds { + $contrast-ratio: get-contrast-ratio($bg, $fg); + @debug "Contrast ratio for #{$bg} and #{$fg} is #{$contrast-ratio}... 🔴"; + @if $contrast-ratio >= $min-contrast-ratio { + @return $fg; + } @else if $contrast-ratio > $max-ratio { + $max-ratio: $contrast-ratio; + $max-ratio-color: $fg; + } + } + @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$bg}..."; + + @return $max-ratio-color; +} + +@function get-contrast-ratio($bg, $foreground: #ced6dd) { + @debug "Calculating contrast ratio for #{$bg} 💡"; + $l1: luminance($bg); + $l2: luminance($foreground); + + // return the relative contrast ratio + @if $l1 > $l2 { + @return ($l1 + 0.05) / ($l2 + 0.05); + } @else { + @return ($l2 + 0.05) / ($l1 + 0.05); + } +} + +// Return WCAG2.1 relative luminance +// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance +// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio -@function text-color($value) { - // Using WCAG luminance formula https://www.w3.org/TR/WCAG20/#relativeluminancedef - // this function will return text-colour that would meet WCAG AA contrast ratio - $luminance: (0.2126 * red($value)) + (0.7152 * green($value)) + - (0.0722 * blue($value)); - @return if( - $luminance >= 0.1791, - "var(--pst-color-black)", - "var(--pst-color-black)" +@function luminance($target-color) { + @debug "Calculating luminance for #{$target-color}"; + $rgb-col: ( + "r": red($target-color), + "g": green($target-color), + "b": blue($target-color), + ); + + @each $channel, $value in $rgb-col { + // here we get RsRGB, GsRGB, and BsRGB + @if $value / 255 <=0.03928 { + $rgb-col: map-merge( + $rgb-col, + ( + $channel: ( + $value / 255, + ) / + 12.92, + ) + ); + } @else { + $rgb-col: map-merge( + $rgb-col, + ( + $channel: nth($_luminance-list, $value + 1), + ) + ); + } + } + + @return ( + 0.2126 * map-get($rgb-col, "r") + 0.7152 * map-get($rgb-col, "g") + 0.0722 * + map-get($rgb-col, "b") ); } @@ -61,10 +152,9 @@ $sd-semantic-color-names: ( $extra-semantic-colors: ( "dark": map-get($pst-semantic-colors, "text-base"), "muted": map-get($pst-semantic-colors, "text-muted"), - "light": rgb(201, 201, 201), - "black": hsl(216, 20%, 10%), - //gray-900 - "white": rgb(255, 255, 255), + "light": $foundation-light-grey, + "black": $foundation-black, + "white": $foundation-white, ); $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); @@ -75,20 +165,22 @@ $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); @each $name in $sd-semantic-color-names { // check if this color is defined differently for light/dark $value: map-get($all-colors, $name); + @debug "Using #{$name}: #{$value} 🔴"; @if type-of($value) == map { - $value: map-get($value, $mode); + $value: #{map-get($value, $mode)}; + @debug "Using #{$mode} for #{$name}: #{$value}"; } // define the pst variables, so that downstream user overrides will work --pst-color-#{$name}: #{$value}; - // TODO: update to allow for new scheme - --pst-color-#{$name}-text: #{text-color($value)}; - // TODO: check where highlight is used - --pst-color-#{$name}-highlight: #{darken($value, 15%)}; - // override the sphinx-design variables + // TODO: the text might be best set in the component itself + // --pst-color-#{$name}-text: #{a11y-combination($value)}; + // // TODO: check where highlight is used + // --pst-color-#{$name}-highlight: #{darken(#{$value}, 15%)}; + // // override the sphinx-design variables --sd-color-#{$name}: var(--pst-color-#{$name}); - --sd-color-#{$name}-text: var(--pst-color-#{$name}-text); + // --sd-color-#{$name}-text: var(--pst-color-#{$name}-text); // TODO: check where highlight is used - --sd-color-#{$name}-highlight: var(--pst-color-#{$name}-highlight); + // --sd-color-#{$name}-highlight: var(--pst-color-#{$name}-highlight); } } } diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index ec75f0e1c..fa0441dc4 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -5,6 +5,19 @@ * To see the full list of colors see https://www.figma.com/file/rUrrHGhUBBIAAjQ82x6pz9/PyData-Design-system---proposal-for-implementation-(2)?node-id=1234%3A765&t=ifcFT1JtnrSshGfi-1 */ +/** +* Function to get items from nested maps +*/ +// @param {Map} $map - Map +// @param {Arglist} $keys - Keys to fetch +// @return {*} +@function map-deep-get($map, $keys...) { + @each $key in $keys { + $map: map-get($map, $key); + } + @return $map; +} + /* Assign base colors for the PyData theme */ $theme-colors: ( // Primary color @@ -76,32 +89,23 @@ $theme-colors: ( --pst-#{$group-color}-#{$color-name}: #{$value}; } } - - // Minimum contrast ratio used for the theme. - // Acceptable values for WCAG 2.0 are 3, 4.5 and 7. - // See https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast - // 4.5 - is for text that is 14pt or less - $min-contrast-ratio-text: 4.5; - // 3 is for text that is 18pt or bold, or for non-text elements - $min-contrast-ratio: 4.5; - - // Customize the light and dark text colors for use in our color contrast function. - $color-contrast-dark: #{pst-color-black}; - $color-contrast-light: #{pst-color-white}; } -/** -* Function to get items from nested maps -*/ -// @param {Map} $map - Map -// @param {Arglist} $keys - Keys to fetch -// @return {*} -@function map-deep-get($map, $keys...) { - @each $key in $keys { - $map: map-get($map, $key); - } - @return $map; -} +// Static SCSS variables used thoroughout the theme +// Minimum contrast ratio used for the theme. +// Acceptable values for WCAG 2.0 are 3, 4.5 and 7. +// See https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast +// 4.5 - is for text that is 14pt or less +$min-contrast-ratio-4: 4.5; +// 3 is for text that is 18pt or bold, or for non-text elements +$min-contrast-ratio-3: 3; + +// Customize the light and dark text colors for use in our color contrast function. +$foundation-black: #14181e; +$foundation-white: #ffffff; +$base-light-text: #ced6dd; +// used in sphinx_design - grey 100 +$foundation-light-grey: #f3f4f5; $pst-semantic-colors: ( "primary": ( @@ -114,7 +118,6 @@ $pst-semantic-colors: ( ), "info": ( "light": #276be9, - // TODO: update this to passs the bg colours "light-bg": #eff4fd, "dark": #79a3f2, "dark-bg": #06245d, @@ -199,14 +202,11 @@ $pst-semantic-colors: ( @mixin theme-colors($mode) { // check if this color is defined differently for light/dark @each $name, $value in $pst-semantic-colors { - @debug "name: #{$name}"; @if type-of($value) == map { @each $key, $val in $value { // since now we define the bg colours in the semantic colours and not // by changing opacity, we need to check if the key contains bg @if (str-index($key, "bg")) != null { - @debug "key: #{$key}"; - @debug "val: #{$val}"; --pst-color-#{$key}: #{$val}; } } From 244772a23bef0a89f0f9508a49a16396039dc600 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Sun, 19 Feb 2023 17:42:27 +0000 Subject: [PATCH 13/64] Update variables and remove debugs --- .../assets/styles/extensions/_sphinx_design.scss | 7 +------ .../assets/styles/variables/_color.scss | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 2dac34e30..99fcf429c 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -61,7 +61,7 @@ $_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 $target-color-contrast-dark: $foundation-black, $target-color-contrast-light: $base-light-text, $target-color-contrast-white: $foundation-white, - $min-contrast-ratio: $min-contrast-ratio + $min-contrast-ratio: $min-contrast-ratio-4 ) { // will test against our two base foreground colors $foregrounds: $target-color-contrast-light, $target-color-contrast-dark; @@ -71,7 +71,6 @@ $_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 @debug "Using AA #{$min-contrast-ratio}:1 contrast ratio for #{$bg} ♿️"; @each $fg in $foregrounds { $contrast-ratio: get-contrast-ratio($bg, $fg); - @debug "Contrast ratio for #{$bg} and #{$fg} is #{$contrast-ratio}... 🔴"; @if $contrast-ratio >= $min-contrast-ratio { @return $fg; } @else if $contrast-ratio > $max-ratio { @@ -85,7 +84,6 @@ $_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 } @function get-contrast-ratio($bg, $foreground: #ced6dd) { - @debug "Calculating contrast ratio for #{$bg} 💡"; $l1: luminance($bg); $l2: luminance($foreground); @@ -102,7 +100,6 @@ $_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 // See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio @function luminance($target-color) { - @debug "Calculating luminance for #{$target-color}"; $rgb-col: ( "r": red($target-color), "g": green($target-color), @@ -165,10 +162,8 @@ $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); @each $name in $sd-semantic-color-names { // check if this color is defined differently for light/dark $value: map-get($all-colors, $name); - @debug "Using #{$name}: #{$value} 🔴"; @if type-of($value) == map { $value: #{map-get($value, $mode)}; - @debug "Using #{$mode} for #{$name}: #{$value}"; } // define the pst variables, so that downstream user overrides will work --pst-color-#{$name}: #{$value}; diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index fa0441dc4..5a8ee9119 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -148,7 +148,7 @@ $pst-semantic-colors: ( ), "text-base": ( "light": #{map-deep-get($theme-colors, "gray", "800")}, - "dark": #ced6dd, + "dark": $base-light-text, ), "text-muted": ( "light": #{map-deep-get($theme-colors, "gray", "600")}, @@ -195,7 +195,7 @@ $pst-semantic-colors: ( "on-surface": ( "light": #{map-deep-get($theme-colors, "gray", "800")}, - "dark": #ced6dd, + "dark": $base-light-text, ), ); From 7ef23d8f696038af774a4ac65db57d9f63570b9e Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Thu, 23 Feb 2023 16:16:47 +0000 Subject: [PATCH 14/64] :zap: Improve colours parsing --- .../assets/styles/variables/_color.scss | 135 +++++++++++------- 1 file changed, 80 insertions(+), 55 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 5a8ee9119..8156eab5b 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -19,9 +19,9 @@ } /* Assign base colors for the PyData theme */ -$theme-colors: ( +$color-palette: ( // Primary color - "light-blue": + "teal": ( "50": #f4fbfc, "100": #e9f6f8, @@ -58,7 +58,7 @@ $theme-colors: ( "400": #9ca4af, "500": #677384, "600": #48566b, - "700": #364150, + "700": #29313d, "800": #222832, "900": #14181e, ), @@ -83,10 +83,10 @@ $theme-colors: ( ); :root { - // Add theme colours to the html element - @each $group-color, $color in $theme-colors { - @each $color-name, $value in $color { - --pst-#{$group-color}-#{$color-name}: #{$value}; + // Add theme colours to the html root element + @each $group-color, $color in $color-palette { + @each $color-name, $definition in $color { + --pst-#{$group-color}-#{$color-name}: #{$definition}; } } } @@ -109,64 +109,78 @@ $foundation-light-grey: #f3f4f5; $pst-semantic-colors: ( "primary": ( - light: #{map-deep-get($theme-colors, "light-blue", "500")}, - dark: #{map-deep-get($theme-colors, "light-blue", "400")}, + "light": #{map-deep-get($color-palette, "teal", "500")}, + "bg-light": #{map-deep-get($color-palette, "teal", "100")}, + "dark": #{map-deep-get($color-palette, "teal", "400")}, + "bg-dark": #{map-deep-get($color-palette, "teal", "800")}, ), "secondary": ( - light: #{map-deep-get($theme-colors, "violet", "500")}, - dark: #{map-deep-get($theme-colors, "violet", "400")}, + "light": #{map-deep-get($color-palette, "violet", "500")}, + "bg-light": #{map-deep-get($color-palette, "violet", "100")}, + "dark": #{map-deep-get($color-palette, "violet", "400")}, + "bg-dark": #{map-deep-get($color-palette, "violet", "800")}, + ), + "accent": ( + "light": #{map-deep-get($color-palette, "pink", "500")}, + "bg-light": #{map-deep-get($color-palette, "pink", "100")}, + "dark": #{map-deep-get($color-palette, "pink", "400")}, + "bg-dark": #{map-deep-get($color-palette, "pink", "800")}, ), "info": ( "light": #276be9, - "light-bg": #eff4fd, + "bg-light": #eff4fd, "dark": #79a3f2, - "dark-bg": #06245d, + "bg-dark": #06245d, ), "warning": ( "light": #f66a0a, - "light-bg": #fff8f2, + "bg-light": #fff8f2, "dark": #ff9245, - "dark-bg": #652a02, + "bg-dark": #652a02, ), "success": ( "light": #00843f, - "light-bg": #ecf6f1, + "bg-light": #ecf6f1, "dark": #5fb488, - "dark-bg": #002f17, - ), - "attention": ( - "light": #f66a0a, - "light-bg": #fff8f2, - "dark": #ff9245, - "dark-bg": #652a02, + "bg-dark": #002f17, ), + // This is is based on the warning color + "attention": + ( + "light": var(--pst-colors-warning), + "bg-light": var(--pst-colors-warning-bg-light), + "dark": var(--pst-colors-warning), + "bg-dark": var(--pst-colors-warning-bg-dark), + ), "danger": ( "light": #d72d47, - "light-bg": #fcf1f2, + "bg-light": #fcf1f2, "dark": #e78894, - "dark-bg": #4e111b, + "bg-dark": #4e111b, ), "text-base": ( - "light": #{map-deep-get($theme-colors, "gray", "800")}, + "light": #{map-deep-get($color-palette, "gray", "800")}, "dark": $base-light-text, ), "text-muted": ( - "light": #{map-deep-get($theme-colors, "gray", "600")}, - "dark": #{map-deep-get($theme-colors, "gray", "300")}, + "light": #{map-deep-get($color-palette, "gray", "600")}, + "dark": #{map-deep-get($color-palette, "gray", "300")}, ), "shadow": ( "light": rgba(0, 0, 0, 0.1), "dark": rgba(0, 0, 0, 0.2), ), - // TODO- update (need muted and regular - this is muted) - "border": - ( - "light": rgba(23, 23, 26, 0.2), - "dark": #{map-deep-get($theme-colors, "gray", "600")}, - ), + "border": ( + "light": #{map-deep-get($color-palette, "gray", "300")}, + "dark": #{map-deep-get($color-palette, "gray", "500")}, + ), + "border-muted": ( + "light": rgba(23, 23, 26, 0.2), + "dark": #{map-deep-get($color-palette, "gray", "600")}, + ), "inline-code": ( - "light": #{map-deep-get($theme-colors, "pink", "600")}, - "dark": #{map-deep-get($theme-colors, "pink", "300")}, + "light": #{map-deep-get($color-palette, "pink", "600")}, + "dark": #{map-deep-get($color-palette, "pink", "300")}, ), "target": ( "light": #8b6e31, @@ -177,43 +191,54 @@ $pst-semantic-colors: ( // background: color of the canvas / the furthest back layer "background": ( - "light": #{map-deep-get($theme-colors, "foundation", "white")}, - "dark": #{map-deep-get($theme-colors, "foundation", "black")}, + "light": #{map-deep-get($color-palette, "foundation", "white")}, + "dark": #{map-deep-get($color-palette, "foundation", "black")}, ), // on-background: provides slight contrast against background // (by use of shadows in light theme) "on-background": ( - "light": #{map-deep-get($theme-colors, "foundation", "white")}, - "dark": #{map-deep-get($theme-colors, "gray", "800")}, + "light": #{map-deep-get($color-palette, "foundation", "white")}, + "dark": #{map-deep-get($color-palette, "gray", "800")}, ), "surface": ( - "light": #{map-deep-get($theme-colors, "gray", "100")}, - "dark": #{map-deep-get($theme-colors, "gray", "700")}, + "light": #{map-deep-get($color-palette, "gray", "100")}, + "dark": #{map-deep-get($color-palette, "gray", "700")}, ), // on_surface: object on top of surface object (without shadows) "on-surface": ( - "light": #{map-deep-get($theme-colors, "gray", "800")}, + "light": #{map-deep-get($color-palette, "gray", "800")}, "dark": $base-light-text, ), ); @mixin theme-colors($mode) { // check if this color is defined differently for light/dark - @each $name, $value in $pst-semantic-colors { - @if type-of($value) == map { - @each $key, $val in $value { - // since now we define the bg colours in the semantic colours and not - // by changing opacity, we need to check if the key contains bg - @if (str-index($key, "bg")) != null { - --pst-color-#{$key}: #{$val}; + @debug "mode: #{$mode} 🌕"; + @each $col-name, $definition in $pst-semantic-colors { + @debug "key: #{$col-name}"; + @if type-of($definition) == map { + @each $key, $val in $definition { + @if str-index($key, $mode) != null { + // since now we define the bg colours in the semantic colours and not + // by changing opacity, we need to check if the key contains bg and the + // correct mode (light/dark) + @if str-index($key, "bg") != null { + --pst-color-bg-#{$col-name}: #{$val}; + @debug "📡 Added name: --pst-color-bg-#{$col-name}: #{$val}"; + } @else { + --pst-color-#{$col-name}: #{$val}; + @debug "📝 Added name: --pst-color-#{$col-name}: #{$val}"; + } } } - $value: map-get($value, $mode); + } @else { + @debug "name: #{$col-name} - value: #{$definition}"; + --pst-color-#{$col-name}: #{$definition}; } - --pst-color-#{$name}: #{$value}; } + // assign the "duplicate" colors (ones that just reference other variables) & { --pst-color-link: var(--pst-color-primary); @@ -265,8 +290,8 @@ html:not([data-theme]) { } // assign classes too, for runtime use of theme colors -@each $name, $value in $pst-semantic-colors { - .pst-color-#{$name} { - color: var(--pst-color-#{$name}); +@each $col-name, $definition in $pst-semantic-colors { + .pst-color-#{$col-name} { + color: var(--pst-color-#{$col-name}); } } From ef43e09abcdc9d89a0934f0e3fd86e2cec2c047c Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Thu, 23 Feb 2023 19:21:18 +0000 Subject: [PATCH 15/64] :wheelchair: Update admonition bg colours --- .../styles/components/_versionmodified.scss | 17 ++----- .../assets/styles/content/_admonitions.scss | 51 ++++++------------- .../assets/styles/variables/_color.scss | 15 ++---- 3 files changed, 24 insertions(+), 59 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/components/_versionmodified.scss b/src/pydata_sphinx_theme/assets/styles/components/_versionmodified.scss index e99b0cf06..a8f03d1f3 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_versionmodified.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_versionmodified.scss @@ -18,32 +18,23 @@ div.deprecated { margin-bottom: 0.6rem; margin-top: 0.6rem; - @include background-from-color-variable(--pst-color-info); + @include format-before(--pst-color-info); } } div.versionadded { border-color: var(--pst-color-success); - - p:before { - background-color: var(--pst-color-success); - } + background-color: var(--pst-color-success-bg); } div.versionchanged { border-color: var(--pst-color-warning); - - p:before { - background-color: var(--pst-color-warning); - } + background-color: var(--pst-color-warning-bg); } div.deprecated { border-color: var(--pst-color-danger); - - p:before { - background-color: var(--pst-color-danger); - } + background-color: var(--pst-color-danger-bg); } span.versionmodified { diff --git a/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss b/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss index 325ac5ec6..aa00ee69a 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss @@ -38,6 +38,7 @@ div.admonition, padding: 0.4rem 0.6rem 0.4rem 2rem; font-weight: var(--pst-font-weight-heading); position: relative; + background-color: var(--pst-color-info-bg); &:after { position: absolute; @@ -51,7 +52,7 @@ div.admonition, opacity: 1; } - @include background-from-color-variable(--pst-color-info); + @include format-before(--pst-color-info); // Next element after title needs some extra upper-space + * { @@ -62,9 +63,7 @@ div.admonition, &.attention { border-color: var(--pst-color-attention); > .admonition-title { - &:before { - background-color: var(--pst-color-attention); - } + background-color: var(--pst-color-warning-bg); &:after { color: var(--pst-color-attention); @@ -76,9 +75,7 @@ div.admonition, &.caution { border-color: var(--pst-color-warning); > .admonition-title { - &:before { - background-color: var(--pst-color-warning); - } + background-color: var(--pst-color-warning-bg); &:after { color: var(--pst-color-warning); @@ -90,9 +87,7 @@ div.admonition, &.warning { border-color: var(--pst-color-warning); > .admonition-title { - &:before { - background-color: var(--pst-color-warning); - } + background-color: var(--pst-color-warning-bg); &:after { color: var(--pst-color-warning); @@ -104,9 +99,7 @@ div.admonition, &.danger { border-color: var(--pst-color-danger); > .admonition-title { - &:before { - background-color: var(--pst-color-danger); - } + background-color: var(--pst-color-danger-bg); &:after { color: var(--pst-color-danger); @@ -118,9 +111,7 @@ div.admonition, &.error { border-color: var(--pst-color-danger); > .admonition-title { - &:before { - background-color: var(--pst-color-danger); - } + background-color: var(--pst-color-danger-bg); &:after { color: var(--pst-color-danger); @@ -132,9 +123,7 @@ div.admonition, &.hint { border-color: var(--pst-color-success); > .admonition-title { - &:before { - background-color: var(--pst-color-success); - } + background-color: var(--pst-color-success-bg); &:after { color: var(--pst-color-success); @@ -146,9 +135,7 @@ div.admonition, &.tip { border-color: var(--pst-color-success); > .admonition-title { - &:before { - background-color: var(--pst-color-success); - } + background-color: var(--pst-color-success-bg); &:after { color: var(--pst-color-success); @@ -160,9 +147,7 @@ div.admonition, &.important { border-color: var(--pst-color-attention); > .admonition-title { - &:before { - background-color: var(--pst-color-attention); - } + background-color: var(--pst-color-warning-bg); &:after { color: var(--pst-color-attention); @@ -174,9 +159,7 @@ div.admonition, &.note { border-color: var(--pst-color-info); > .admonition-title { - &:before { - background-color: var(--pst-color-info); - } + background-color: var(--pst-color-info-bg); &:after { color: var(--pst-color-info); @@ -188,9 +171,7 @@ div.admonition, &.seealso { border-color: var(--pst-color-success); > .admonition-title { - &:before { - background-color: var(--pst-color-success); - } + background-color: var(--pst-color-success-bg); &:after { color: var(--pst-color-success); @@ -200,14 +181,12 @@ div.admonition, } &.admonition-todo { - border-color: var(--pst-color-border); + border-color: var(--pst-color-secondary); > .admonition-title { - &:before { - background-color: var(--pst-color-border); - } + background-color: var(--pst-color-secondary-bg); &:after { - color: var(--pst-color-border); + color: var(--pst-color-secondary); content: var(--pst-icon-admonition-todo); } } diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 8156eab5b..3b42da96e 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -147,10 +147,10 @@ $pst-semantic-colors: ( // This is is based on the warning color "attention": ( - "light": var(--pst-colors-warning), - "bg-light": var(--pst-colors-warning-bg-light), - "dark": var(--pst-colors-warning), - "bg-dark": var(--pst-colors-warning-bg-dark), + "light": var(--pst-color-warning), + "bg-light": var(--pst-color-warning-bg-light), + "dark": var(--pst-color-warning), + "bg-dark": var(--pst-color-warning-bg-dark), ), "danger": ( "light": #d72d47, @@ -215,9 +215,7 @@ $pst-semantic-colors: ( @mixin theme-colors($mode) { // check if this color is defined differently for light/dark - @debug "mode: #{$mode} 🌕"; @each $col-name, $definition in $pst-semantic-colors { - @debug "key: #{$col-name}"; @if type-of($definition) == map { @each $key, $val in $definition { @if str-index($key, $mode) != null { @@ -225,16 +223,13 @@ $pst-semantic-colors: ( // by changing opacity, we need to check if the key contains bg and the // correct mode (light/dark) @if str-index($key, "bg") != null { - --pst-color-bg-#{$col-name}: #{$val}; - @debug "📡 Added name: --pst-color-bg-#{$col-name}: #{$val}"; + --pst-color-#{$col-name}-bg: #{$val}; } @else { --pst-color-#{$col-name}: #{$val}; - @debug "📝 Added name: --pst-color-#{$col-name}: #{$val}"; } } } } @else { - @debug "name: #{$col-name} - value: #{$definition}"; --pst-color-#{$col-name}: #{$definition}; } } From 16678ea1a110677597d3e6856071c2e7dd79235b Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Thu, 23 Feb 2023 19:37:57 +0000 Subject: [PATCH 16/64] Update headings colours --- .../assets/styles/base/_base.scss | 12 ++++++------ .../assets/styles/variables/_color.scss | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/base/_base.scss b/src/pydata_sphinx_theme/assets/styles/base/_base.scss index 3791f42fc..210eee7aa 100644 --- a/src/pydata_sphinx_theme/assets/styles/base/_base.scss +++ b/src/pydata_sphinx_theme/assets/styles/base/_base.scss @@ -49,8 +49,8 @@ a { } &.headerlink { - color: var(--pst-color-warning); - opacity: 0.4; + color: var(--pst-color-secondary); + opacity: 0.6; font-size: 0.8em; padding: 0 4px 0 4px; margin-left: 0.2em; @@ -93,25 +93,25 @@ h1 { @extend .heading-style; margin-top: 0; font-size: var(--pst-font-size-h1); - color: var(--pst-color-primary); + color: var(--pst-heading-color); } h2 { @extend .heading-style; font-size: var(--pst-font-size-h2); - color: var(--pst-color-primary); + color: var(--pst-heading-color); } h3 { @extend .heading-style; font-size: var(--pst-font-size-h3); - color: var(--pst-color-text-base); + color: var(--pst-heading-color); } h4 { @extend .heading-style; font-size: var(--pst-font-size-h4); - color: var(--pst-color-text-base); + color: var(--pst-heading-color); } h5 { diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 3b42da96e..2328d782d 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -166,6 +166,10 @@ $pst-semantic-colors: ( "light": #{map-deep-get($color-palette, "gray", "600")}, "dark": #{map-deep-get($color-palette, "gray", "300")}, ), + "heading-color": ( + "light": #{$foundation-white}, + "dark": #{$foundation-black}, + ), "shadow": ( "light": rgba(0, 0, 0, 0.1), "dark": rgba(0, 0, 0, 0.2), From 0c9a6b5fe2569db30988d94be61807ca55d589d5 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 24 Feb 2023 12:28:30 +0000 Subject: [PATCH 17/64] :wheelchair: Change topic text colour and replace mixins --- src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss | 5 ++--- .../assets/styles/content/_admonitions.scss | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index ca8e17096..507efa1d2 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -72,9 +72,9 @@ } /** - * Assign the admonition colours from our variables + * Format before pseudo element - TODO: decide if we still need this */ -@mixin assign-background-color($color-variable) { +@mixin format-before($color-variable) { &:before { content: ""; width: 100%; @@ -82,7 +82,6 @@ position: absolute; left: 0; top: 0; - background-color: var(#{$color-variable}-bg); // So that hovering over the text within background is still possible. // Otherwise the background overlays the text and you cannot click or select easily. diff --git a/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss b/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss index aa00ee69a..2373799bd 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss @@ -267,6 +267,11 @@ aside.topic { margin: 0 0 0.5rem 0; } + // Over-ride text color to ensure enough contrast + p { + color: var(--pst-color-on-surface) !important; + } + // Over-ride large default padding ul.simple { padding-left: 1rem; From f89e2628c6eae3aa4d8ba0e28b2868a95c5022b0 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 24 Feb 2023 12:28:55 +0000 Subject: [PATCH 18/64] :wheelchair: Minor tweaks to secondary colour --- .../assets/styles/variables/_color.scss | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 2328d782d..36a2e2adf 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -37,15 +37,15 @@ $color-palette: ( // Secondary color "violet": ( - "50": #fbf8fe, - "100": #f6f2fe, - "200": #ece3fc, - "300": #decdfa, - "400": #b691f5, - "500": #894def, - "600": #6730c5, - "700": #4e2595, - "800": #31175f, + "50": #f4eefb, + "100": #e1cafe, + "200": #cda5ff, + "300": #b680ff, + "400": #9c5ffd, + "500": #8045e5, + "600": #6432bd, + "700": #4b258f, + "800": #341a61, "900": #1e0e39, ), // Neutrals @@ -103,6 +103,8 @@ $min-contrast-ratio-3: 3; // Customize the light and dark text colors for use in our color contrast function. $foundation-black: #14181e; $foundation-white: #ffffff; +// This is a custom - calculated color between gray 100 and 200 - to reduce +// the contrast ratio (avoid a jarring effect) $base-light-text: #ced6dd; // used in sphinx_design - grey 100 $foundation-light-grey: #f3f4f5; @@ -213,7 +215,7 @@ $pst-semantic-colors: ( "on-surface": ( "light": #{map-deep-get($color-palette, "gray", "800")}, - "dark": $base-light-text, + "dark": $foundation-light-grey, ), ); From 055f7c05afbb7ae56bf5c6102c7d96ba761f8b25 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 24 Feb 2023 12:51:24 +0000 Subject: [PATCH 19/64] :wheelchair: Update code and announcement colours --- src/pydata_sphinx_theme/assets/styles/content/_code.scss | 2 +- .../assets/styles/sections/_announcement.scss | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/content/_code.scss b/src/pydata_sphinx_theme/assets/styles/content/_code.scss index e20129ddf..78792b0d1 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_code.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_code.scss @@ -51,6 +51,6 @@ div.literal-block-wrapper { code.literal { padding: 0.1rem 0.25rem; background-color: var(--pst-color-surface); - border: 1px solid var(--pst-color-on-surface); + border: 1px solid var(--pst-color-border); border-radius: 0.25rem; } diff --git a/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss b/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss index b2287d6aa..315197608 100644 --- a/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss +++ b/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss @@ -18,15 +18,14 @@ margin: 0; } - // The same background color transparency hack we use in admonitions + // Bg color is now defined in the theme color palette &:after { position: absolute; width: 100%; height: 100%; left: 0; top: 0; - background-color: var(--pst-color-info); - opacity: 0.2; + background-color: var(--pst-color-secondary-bg); content: ""; z-index: -1; // So it doesn't hover over the content } From 7930b5da5d37ec7d9a0dbaa80e6daba3fca92221 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 24 Feb 2023 13:13:34 +0000 Subject: [PATCH 20/64] Update text-muted in dark theme --- src/pydata_sphinx_theme/assets/styles/variables/_color.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 36a2e2adf..47076e4f2 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -166,7 +166,7 @@ $pst-semantic-colors: ( ), "text-muted": ( "light": #{map-deep-get($color-palette, "gray", "600")}, - "dark": #{map-deep-get($color-palette, "gray", "300")}, + "dark": #{map-deep-get($color-palette, "gray", "400")}, ), "heading-color": ( "light": #{$foundation-white}, From a663273bf11f5e5b5dd634c830cb36c3572274fb Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 24 Feb 2023 18:57:42 +0000 Subject: [PATCH 21/64] =?UTF-8?q?=E2=99=BF=EF=B8=8F=20=20Buttons=20are=20n?= =?UTF-8?q?ow=20WCAG=20AA=20conformant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/styles/abstracts/_mixins.scss | 162 +++++++++++++++++- .../styles/extensions/_sphinx_design.scss | 129 ++------------ 2 files changed, 175 insertions(+), 116 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index 507efa1d2..9ac42aa3f 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -105,7 +105,7 @@ * Function to get items from nested maps */ // @param {Map} $map - Map -// @param {Arglist} $keys - Keys to fetch +// @param {Arglist} $keys - Keys to fetc // @return {*} @function map-deep-get($map, $keys...) { @each $key in $keys { @@ -113,3 +113,163 @@ } @return $map; } + +/** +* Function to convert the string represenation of a color to a color type +*/ +// @param {String} $string - String representation of a color +@function from-hex($string) { + $string-lower: to-lower-case($string); + $r: ""; + $g: ""; + $b: ""; + $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"; + $length: str-length($string); + $max: if($length == 4, 1, 2); + + // Check for length accuracy + @if $length != 4 and $length != 7 { + @return $string; + } + + // Loop from the second character (omitting #) + @for $i from 2 through $length { + $c: str-slice($string-lower, $i, $i); + + // If wrong character, return + @if index($hex, $c) == null { + @return $string; + } + + @if str-length($r) < $max { + $r: $r + $c; + } @else if str-length($g) < $max { + $g: $g + $c; + } @else if str-length($b) < $max { + $b: $b + $c; + } + } + + @if $length == 4 { + $r: $r + $r; + $g: $g + $g; + $b: $b + $b; + } + + @return rgb(_hex-to-dec($r), _hex-to-dec($g), _hex-to-dec($b)); +} + +@function _hex-to-dec($string) { + $hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"; + $string: to-lower-case($string); + $length: str-length($string); + + $dec: 0; + @for $i from 1 through $length { + $factor: 1 + (15 * ($length - $i)); + $index: index($hex, str-slice($string, $i, $i)); + $dec: $dec + $factor * ($index - 1); + } + + @return $dec; +} + +// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255) +$_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 + 0.0027 0.003 0.0033 0.0037 0.004 0.0044 0.0048 0.0052 0.0056 0.006 0.0065 + 0.007 0.0075 0.008 0.0086 0.0091 0.0097 0.0103 0.011 0.0116 0.0123 0.013 + 0.0137 0.0144 0.0152 0.016 0.0168 0.0176 0.0185 0.0194 0.0203 0.0212 0.0222 + 0.0232 0.0242 0.0252 0.0262 0.0273 0.0284 0.0296 0.0307 0.0319 0.0331 0.0343 + 0.0356 0.0369 0.0382 0.0395 0.0409 0.0423 0.0437 0.0452 0.0467 0.0482 0.0497 + 0.0513 0.0529 0.0545 0.0561 0.0578 0.0595 0.0612 0.063 0.0648 0.0666 0.0685 + 0.0704 0.0723 0.0742 0.0762 0.0782 0.0802 0.0823 0.0844 0.0865 0.0887 0.0908 + 0.0931 0.0953 0.0976 0.0999 0.1022 0.1046 0.107 0.1095 0.1119 0.1144 0.117 + 0.1195 0.1221 0.1248 0.1274 0.1301 0.1329 0.1356 0.1384 0.1413 0.1441 0.147 + 0.15 0.1529 0.1559 0.159 0.162 0.1651 0.1683 0.1714 0.1746 0.1779 0.1812 + 0.1845 0.1878 0.1912 0.1946 0.1981 0.2016 0.2051 0.2086 0.2122 0.2159 0.2195 + 0.2232 0.227 0.2307 0.2346 0.2384 0.2423 0.2462 0.2502 0.2542 0.2582 0.2623 + 0.2664 0.2705 0.2747 0.2789 0.2831 0.2874 0.2918 0.2961 0.3005 0.305 0.3095 + 0.314 0.3185 0.3231 0.3278 0.3325 0.3372 0.3419 0.3467 0.3515 0.3564 0.3613 + 0.3663 0.3712 0.3763 0.3813 0.3864 0.3916 0.3968 0.402 0.4072 0.4125 0.4179 + 0.4233 0.4287 0.4342 0.4397 0.4452 0.4508 0.4564 0.4621 0.4678 0.4735 0.4793 + 0.4851 0.491 0.4969 0.5029 0.5089 0.5149 0.521 0.5271 0.5333 0.5395 0.5457 + 0.552 0.5583 0.5647 0.5711 0.5776 0.5841 0.5906 0.5972 0.6038 0.6105 0.6172 + 0.624 0.6308 0.6376 0.6445 0.6514 0.6584 0.6654 0.6724 0.6795 0.6867 0.6939 + 0.7011 0.7084 0.7157 0.7231 0.7305 0.7379 0.7454 0.7529 0.7605 0.7682 0.7758 + 0.7835 0.7913 0.7991 0.807 0.8148 0.8228 0.8308 0.8388 0.8469 0.855 0.8632 + 0.8714 0.8796 0.8879 0.8963 0.9047 0.9131 0.9216 0.9301 0.9387 0.9473 0.956 + 0.9647 0.9734 0.9823 0.9911 1; + +@function a11y-combination( + $bg, + $target-color-contrast-dark: $foundation-black, + $target-color-contrast-white: $foundation-white, + $min-contrast-ratio: $min-contrast-ratio-4 +) { + // will test against the specified foreground colors + $foregrounds: $target-color-contrast-white, $target-color-contrast-dark; + $max-ratio: 0; + $max-ratio-color: null; + + @debug "Using AA #{$min-contrast-ratio}:1 contrast ratio for #{$bg} ♿️"; + @each $fg in $foregrounds { + $contrast-ratio: get-contrast-ratio($bg, $fg); + @if $contrast-ratio >= $min-contrast-ratio { + @return $fg; + } @else if $contrast-ratio > $max-ratio { + $max-ratio: $contrast-ratio; + $max-ratio-color: $fg; + } + } + @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$bg}..."; + + @return $max-ratio-color; +} + +@function get-contrast-ratio($bg, $foreground: #ced6dd) { + $l1: luminance($bg); + $l2: luminance($foreground); + + // return the relative contrast ratio + @if $l1 > $l2 { + @return ($l1 + 0.05) / ($l2 + 0.05); + } @else { + @return ($l2 + 0.05) / ($l1 + 0.05); + } +} + +// Return WCAG2.1 relative luminance +// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance +// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio + +@function luminance($target-color) { + $rgb-col: ( + "r": red($target-color), + "g": green($target-color), + "b": blue($target-color), + ); + + @each $channel, $value in $rgb-col { + // here we get RsRGB, GsRGB, and BsRGB + @if $value / 255 <=0.03928 { + $rgb-col: map-merge( + $rgb-col, + ( + $channel: $value / 255 / 12.92, + ) + ); + } @else { + $rgb-col: map-merge( + $rgb-col, + ( + $channel: nth($_luminance-list, $value + 1), + ) + ); + } + } + + @return ( + 0.2126 * map-get($rgb-col, "r") + 0.7152 * map-get($rgb-col, "g") + 0.0722 * + map-get($rgb-col, "b") + ); +} diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 99fcf429c..8c2bc5d4e 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -5,8 +5,7 @@ * NOTE: sphinx-design uses !important quite liberally, so here we must do the * same for our overrides to have any effect. */ - -@use "../variables/color" as *; +@use "../variables/color" as pst-color; @use "sass:color" as color; /******************************************************************************* @@ -30,110 +29,6 @@ $sd-semantic-color-names: ( "white" ); -// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255) -$_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 - 0.0027 0.003 0.0033 0.0037 0.004 0.0044 0.0048 0.0052 0.0056 0.006 0.0065 - 0.007 0.0075 0.008 0.0086 0.0091 0.0097 0.0103 0.011 0.0116 0.0123 0.013 - 0.0137 0.0144 0.0152 0.016 0.0168 0.0176 0.0185 0.0194 0.0203 0.0212 0.0222 - 0.0232 0.0242 0.0252 0.0262 0.0273 0.0284 0.0296 0.0307 0.0319 0.0331 0.0343 - 0.0356 0.0369 0.0382 0.0395 0.0409 0.0423 0.0437 0.0452 0.0467 0.0482 0.0497 - 0.0513 0.0529 0.0545 0.0561 0.0578 0.0595 0.0612 0.063 0.0648 0.0666 0.0685 - 0.0704 0.0723 0.0742 0.0762 0.0782 0.0802 0.0823 0.0844 0.0865 0.0887 0.0908 - 0.0931 0.0953 0.0976 0.0999 0.1022 0.1046 0.107 0.1095 0.1119 0.1144 0.117 - 0.1195 0.1221 0.1248 0.1274 0.1301 0.1329 0.1356 0.1384 0.1413 0.1441 0.147 - 0.15 0.1529 0.1559 0.159 0.162 0.1651 0.1683 0.1714 0.1746 0.1779 0.1812 - 0.1845 0.1878 0.1912 0.1946 0.1981 0.2016 0.2051 0.2086 0.2122 0.2159 0.2195 - 0.2232 0.227 0.2307 0.2346 0.2384 0.2423 0.2462 0.2502 0.2542 0.2582 0.2623 - 0.2664 0.2705 0.2747 0.2789 0.2831 0.2874 0.2918 0.2961 0.3005 0.305 0.3095 - 0.314 0.3185 0.3231 0.3278 0.3325 0.3372 0.3419 0.3467 0.3515 0.3564 0.3613 - 0.3663 0.3712 0.3763 0.3813 0.3864 0.3916 0.3968 0.402 0.4072 0.4125 0.4179 - 0.4233 0.4287 0.4342 0.4397 0.4452 0.4508 0.4564 0.4621 0.4678 0.4735 0.4793 - 0.4851 0.491 0.4969 0.5029 0.5089 0.5149 0.521 0.5271 0.5333 0.5395 0.5457 - 0.552 0.5583 0.5647 0.5711 0.5776 0.5841 0.5906 0.5972 0.6038 0.6105 0.6172 - 0.624 0.6308 0.6376 0.6445 0.6514 0.6584 0.6654 0.6724 0.6795 0.6867 0.6939 - 0.7011 0.7084 0.7157 0.7231 0.7305 0.7379 0.7454 0.7529 0.7605 0.7682 0.7758 - 0.7835 0.7913 0.7991 0.807 0.8148 0.8228 0.8308 0.8388 0.8469 0.855 0.8632 - 0.8714 0.8796 0.8879 0.8963 0.9047 0.9131 0.9216 0.9301 0.9387 0.9473 0.956 - 0.9647 0.9734 0.9823 0.9911 1; - -@function a11y-combination( - $bg, - $target-color-contrast-dark: $foundation-black, - $target-color-contrast-light: $base-light-text, - $target-color-contrast-white: $foundation-white, - $min-contrast-ratio: $min-contrast-ratio-4 -) { - // will test against our two base foreground colors - $foregrounds: $target-color-contrast-light, $target-color-contrast-dark; - $max-ratio: 0; - $max-ratio-color: null; - - @debug "Using AA #{$min-contrast-ratio}:1 contrast ratio for #{$bg} ♿️"; - @each $fg in $foregrounds { - $contrast-ratio: get-contrast-ratio($bg, $fg); - @if $contrast-ratio >= $min-contrast-ratio { - @return $fg; - } @else if $contrast-ratio > $max-ratio { - $max-ratio: $contrast-ratio; - $max-ratio-color: $fg; - } - } - @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$bg}..."; - - @return $max-ratio-color; -} - -@function get-contrast-ratio($bg, $foreground: #ced6dd) { - $l1: luminance($bg); - $l2: luminance($foreground); - - // return the relative contrast ratio - @if $l1 > $l2 { - @return ($l1 + 0.05) / ($l2 + 0.05); - } @else { - @return ($l2 + 0.05) / ($l1 + 0.05); - } -} - -// Return WCAG2.1 relative luminance -// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance -// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio - -@function luminance($target-color) { - $rgb-col: ( - "r": red($target-color), - "g": green($target-color), - "b": blue($target-color), - ); - - @each $channel, $value in $rgb-col { - // here we get RsRGB, GsRGB, and BsRGB - @if $value / 255 <=0.03928 { - $rgb-col: map-merge( - $rgb-col, - ( - $channel: ( - $value / 255, - ) / - 12.92, - ) - ); - } @else { - $rgb-col: map-merge( - $rgb-col, - ( - $channel: nth($_luminance-list, $value + 1), - ) - ); - } - } - - @return ( - 0.2126 * map-get($rgb-col, "r") + 0.7152 * map-get($rgb-col, "g") + 0.0722 * - map-get($rgb-col, "b") - ); -} - /** * Here we create some extra --pst-color-* variables and use * them to override the value of the corresponding sphinx-design variables. @@ -155,6 +50,7 @@ $extra-semantic-colors: ( ); $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); +@debug "sd-semantic-color-names: #{$sd-semantic-color-names}"; // Now we override the --sd-color-* variables. @each $mode in (light, dark) { @@ -163,19 +59,23 @@ $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); // check if this color is defined differently for light/dark $value: map-get($all-colors, $name); @if type-of($value) == map { - $value: #{map-get($value, $mode)}; + $value: map-get($value, $mode); + @if type-of($value) == string { + $value: from-hex($value); + } } // define the pst variables, so that downstream user overrides will work --pst-color-#{$name}: #{$value}; - // TODO: the text might be best set in the component itself - // --pst-color-#{$name}-text: #{a11y-combination($value)}; + // TODO: the text might be best set in the component itself - for now I am leaving + // the previous approach of using the a11y-combination function + --pst-color-#{$name}-text: #{a11y-combination($value)}; // // TODO: check where highlight is used - // --pst-color-#{$name}-highlight: #{darken(#{$value}, 15%)}; - // // override the sphinx-design variables + --pst-color-#{$name}-highlight: #{darken($value, 15%)}; + // override the sphinx-design variables --sd-color-#{$name}: var(--pst-color-#{$name}); - // --sd-color-#{$name}-text: var(--pst-color-#{$name}-text); + --sd-color-#{$name}-text: var(--pst-color-#{$name}-text); // TODO: check where highlight is used - // --sd-color-#{$name}-highlight: var(--pst-color-#{$name}-highlight); + --sd-color-#{$name}-highlight: var(--pst-color-#{$name}-highlight); } } } @@ -305,8 +205,7 @@ details.sd-dropdown { border-left: 0.2rem solid var(--pst-sd-dropdown-color) !important; border-bottom-left-radius: calc(0.25rem - 1px); } - - span.sd-summary-icon { + phi span.sd-summary-icon { display: inline-flex; align-items: center; color: var(--pst-sd-dropdown-color) !important; From f1b3787231c648f50c6b201a4289ffab1e6e3059 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 24 Feb 2023 19:13:39 +0000 Subject: [PATCH 22/64] :lipstick: Update tabs hover --- .../assets/styles/extensions/_sphinx_design.scss | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 8c2bc5d4e..92142fa91 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -133,9 +133,8 @@ html[data-theme="light"] { // hover label &:not(:checked) + label:hover { - border-color: var(--pst-color-primary); - color: var(--pst-color-primary); - opacity: 0.5; + border-color: var(--pst-color-secondary); + color: var(--pst-color-secondary); } } @@ -145,9 +144,8 @@ html[data-theme="light"] { // Hovered label html &:hover { - color: var(--pst-color-primary); - border-color: var(--pst-color-primary); - opacity: 0.5; + color: var(--pst-color-secondary); + border-color: var(--pst-color-secondary); } } } From 5a6ae4cec7f7f553b6c5decee3937c1232216207 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 20 Mar 2023 12:07:40 +0000 Subject: [PATCH 23/64] =?UTF-8?q?=E2=99=BF=EF=B8=8F=20Tweaks=20to=20colour?= =?UTF-8?q?s=20in=20small=20components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/styles/components/_switcher-theme.scss | 4 ++-- .../assets/styles/extensions/_sphinx_design.scss | 1 - .../assets/styles/sections/_announcement.scss | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss b/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss index 81b9dc7a5..0d5cf39fb 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_switcher-theme.scss @@ -21,8 +21,8 @@ &:hover, &:active { // overide bootstrap settings - background-color: var(--pst-color-on-surface) !important; - border-color: var(--pst-color-on-background) !important; + background-color: var(--pst-color-border) !important; + border-color: var(--pst-color-border) !important; a { color: var(--pst-color-text-muted); } diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 92142fa91..18c73c47f 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -50,7 +50,6 @@ $extra-semantic-colors: ( ); $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); -@debug "sd-semantic-color-names: #{$sd-semantic-color-names}"; // Now we override the --sd-color-* variables. @each $mode in (light, dark) { diff --git a/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss b/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss index 315197608..aa59a6bf2 100644 --- a/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss +++ b/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss @@ -18,7 +18,7 @@ margin: 0; } - // Bg color is now defined in the theme color palette + // Bg color is now defined in the theme color palette - using our secondary color &:after { position: absolute; width: 100%; From cb5b81b6bbe96de2fceef42cfea389cf8b577f1b Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 20 Mar 2023 12:08:51 +0000 Subject: [PATCH 24/64] =?UTF-8?q?=E2=99=BF=EF=B8=8F=20Move=20WCAG=20contra?= =?UTF-8?q?st=20to=20mixin=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/user_guide/announcements.rst | 2 +- docs/user_guide/web-components.rst | 21 +++++++++------ .../assets/styles/abstracts/_mixins.scss | 27 +++++++++---------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/docs/user_guide/announcements.rst b/docs/user_guide/announcements.rst index 6c44c2d3b..09f7d8598 100644 --- a/docs/user_guide/announcements.rst +++ b/docs/user_guide/announcements.rst @@ -12,7 +12,7 @@ Provide local HTML in your theme By default, the value of your ``html_theme_options["announcement"]`` will be inserted directly into your announcement banner as raw HTML. -For example, the following configuration adds a simple ``

`` with an announcement. +For example, the following configuration adds a simple block of text (``

``) with an announcement. .. code-block:: python diff --git a/docs/user_guide/web-components.rst b/docs/user_guide/web-components.rst index d01f8dca9..5df510495 100644 --- a/docs/user_guide/web-components.rst +++ b/docs/user_guide/web-components.rst @@ -4,11 +4,14 @@ Sphinx Design Components ======================== -Cards and tabs provide some extra UI flexibility for your content. This theme provides custom CSS to ensure that `sphinx-design `__ elements look and feel consistent with this theme. +The PyData Sphinx Theme uses `sphinx-design `__ +to add several UI components and provide extra flexibility for content creation. +These include badges, buttons, cards, and tabs, among other components. +This theme provides custom CSS to ensure that `sphinx-design `__ elements look and feel consistent with this theme. .. seealso:: - For more about how to use these extensions, see `the sphinx-design documentation `_. + For more information about how to use these extensions, see `the sphinx-design documentation `_. Below you can find some examples of the components created with the :code:`sphinx-design` extension. @@ -18,15 +21,17 @@ Badges and buttons ================== Here are some of the available badges: + :bdg-primary:`primary` -:bdg-secondary:`secondary` +:bdg-secondary:`secondary`` :bdg-success:`success` :bdg-primary-line:`primary outline` :bdg-secondary-line:`secondary outline` :bdg-success-line:`success outline` -Here are some buttons, also using semantic color names. **Note:** in this theme, ``info`` is defined to be the same color as ``primary``, and ``warning`` is the same color as ``secondary``. -If in your site's `custom CSS file `_ you override the `CSS custom properties `_ ``--pst-color-*`` (where ``*`` is one of the semantic color names, e.g., ``primary``, ``danger``, etc), badges and buttons will automatically use the custom color. +Here are some buttons, also using semantic color names. + +If in your site's `custom CSS file `_ you override the `CSS custom properties `_ ``--pst-color-*`` (where ``*`` is one of the semantic color names, e.g., ``primary``, ``danger``, etc.), badges and buttons will automatically use the custom color. .. grid:: auto @@ -162,7 +167,7 @@ Tabs Dropdowns ========= -Dropdowns should look similar to admonitions, but clickable. +Dropdowns look similar to admonitions, but they are clickable interactive elements that can be used to hide content. See `the Sphinx Design Dropdown documentation `__ for more information. .. admonition:: An admonition for reference. @@ -182,13 +187,13 @@ See `the Sphinx Design Dropdown documentation = $min-contrast-ratio { From 9ed2d8c36647ae86df6290d3ae68ddf9d646f851 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 20 Mar 2023 12:47:52 +0000 Subject: [PATCH 25/64] Update theming docs --- docs/user_guide/extending.rst | 3 +-- docs/user_guide/web-components.rst | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/user_guide/extending.rst b/docs/user_guide/extending.rst index 084790199..0bc02a842 100644 --- a/docs/user_guide/extending.rst +++ b/docs/user_guide/extending.rst @@ -39,7 +39,7 @@ Then add the ``dropdown`` class to any admonition directive (shown here on a ``n Custom admonition styles ======================== -A `limited set `__ of admonitions are built-in to docutils (the rST → HTML engine that underlies Sphinx). However, it is possible to create custom admonitions with their own default colors, icons, and titles. +A `limited set `__ of admonitions are built-in to docutils (the ``rST`` → ``HTML`` engine that underlies Sphinx). However, it is possible to create custom admonitions with their own default colors, icons, and titles. Customizing the title @@ -92,7 +92,6 @@ Note that it updates both the color and the icon. This theme defines classes for `the standard docutils admonition types `__ (``attention``, ``caution``, etc) and additionally supports ``seealso`` and ``todo`` admonitions (see :doc:`../examples/kitchen-sink/admonitions` for a demo of all built-in admonition styles). - Customizing the color --------------------- diff --git a/docs/user_guide/web-components.rst b/docs/user_guide/web-components.rst index 5df510495..5a4af875a 100644 --- a/docs/user_guide/web-components.rst +++ b/docs/user_guide/web-components.rst @@ -23,7 +23,7 @@ Badges and buttons Here are some of the available badges: :bdg-primary:`primary` -:bdg-secondary:`secondary`` +:bdg-secondary:`secondary` :bdg-success:`success` :bdg-primary-line:`primary outline` :bdg-secondary-line:`secondary outline` From 8d55e7dcaef46afade0f3c71b0178cbee68d98fb Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 20 Mar 2023 15:03:58 +0000 Subject: [PATCH 26/64] :memo: Update a11y docs --- docs/user_guide/accessibility.rst | 20 ++++++++++++-------- docs/user_guide/styling.rst | 31 ++++++++++++++++++------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/docs/user_guide/accessibility.rst b/docs/user_guide/accessibility.rst index 40e30c4d5..b0b82e3cf 100644 --- a/docs/user_guide/accessibility.rst +++ b/docs/user_guide/accessibility.rst @@ -8,8 +8,7 @@ Accessibility ************* -Creating and publishing content that does not exclude audiences with limited abilities -of various kinds is challenging, but also important, to achieve and then maintain. +Creating and publishing content that does not exclude disabled users is a complex and iterative task. While there is no one-size-fits-all solution to maintaining accessible content, this theme and documentation site use some techniques to avoid common content shortcomings. @@ -34,12 +33,17 @@ page that lacks metadata, please open a pull request to add it! Colors ====== -Our default code highlighting styles are ``a11y-high-contrast-light`` and -``a11y-high-contrast-dark`` from https://github.com/Quansight-Labs/accessible-pygments. -These styles are designed to be more accessible to users with limited visual abilities. -If you don't like the look of our default code highlighting styles, there are several more -to choose from at https://github.com/Quansight-Labs/accessible-pygments. - +* Our default code highlighting styles are ``a11y-high-contrast-light`` and + ``a11y-high-contrast-dark`` from https://github.com/Quansight-Labs/accessible-pygments. + These styles are designed to meet WCAG 2 AA or AAA contrast requirements. + If you don't like the look of our default code highlighting styles, there are several more + to choose from at https://github.com/Quansight-Labs/accessible-pygments. +* We recently revisited the PyData Sphinx theme color palette to ensure that + the colors we use meet WCAG 2 AA or AAA contrast requirements. +* We also re-defined our ``primary`` and ``secondary`` colors to be more accessible and distinct from semantic colors used + to denote success, warning, info, and danger situations. +* We simplified the color palette and removed some colors that were problematic to meet WCAG 2 AA or AAA contrast requirements + and for certain types of colorblindness. What You Can Do ^^^^^^^^^^^^^^^ diff --git a/docs/user_guide/styling.rst b/docs/user_guide/styling.rst index cb8228132..8b6022b26 100644 --- a/docs/user_guide/styling.rst +++ b/docs/user_guide/styling.rst @@ -17,8 +17,8 @@ Any rules in this style-sheet will over-ride the default theme rules. To add a custom stylesheet, follow these steps: -1. **Create a CSS stylesheet** in ``_static/css/custom.css``, and add the CSS rules you wish. -2. **Attach the stylesheet to your Sphinx build**. Add the following to ``conf.py`` +1. **Create a CSS stylesheet** in ``_static/css/custom.css``, and update the CSS rules as desired. +2. **Attach the stylesheet to your Sphinx build**. Add the following to ``conf.py``: .. code-block:: python @@ -37,16 +37,15 @@ This theme defines several `CSS variables `_ that can be used to quickly control behavior and display across your documentation. These are based on top of the basic `Bootstrap CSS variables `_ -extended with some theme specific variables. +extended with some theme-specific variables. -base variables +Base variables -------------- -In order to change a variable, follow these steps: +Follow these steps to update the base variables: 1. :ref:`Add a custom CSS stylesheet `. This is where we'll configure the variables. -2. Underneath a ``html`` section, add the variables you wish to update. For example, to update - the base font size, you might add this to ``custom.css``: +2. Underneath a ``html`` section, add the variables you wish to update. For example, to change the base font size you would add the following to your ``custom.css`` file : .. code-block:: css @@ -60,6 +59,7 @@ In order to change a variable, follow these steps: `SASS variables `_. The theme is defined with CSS variables, not SASS variables! Refer to the previous section if you desire a different behavior between the light and dark theme. +.. TODO: add correct reference to light and dark theme @trallard For a complete list of the theme variables that you may override, see the `theme variables defaults CSS file `_: @@ -82,20 +82,20 @@ For a complete list of the theme variables that you may override, see the Color variables --------------- -There are two special color variables for primary and secondary theme colors (``--pst-color-primary`` and ``--pst-color-secondary``, respectively). +This theme specifies color variables for the primary and secondary colors (``--pst-color-primary`` and ``--pst-color-secondary``, respectively). These are meant to complement one another visually across the theme, if you modify these, choose colors that look good when paired with one another. -There are also several other color variables that control color for admonitions, links, menu items, etc. +There are also several other color variables that control the color for admonitions, links, menu items, etc. Each color variable has two values, one corresponding to the "light" and one for the "dark" theme. These are used throughout many of the theme elements to define text color, background color, etc. Here is an overview of the colors available in the theme (change theme mode to switch from light to dark versions). + .. raw:: html

- primary - secondary - success - info - warning - danger + primary + secondary + secondary + success + info + warning + danger background on-background surface - on-surface - target + on-surface + target

@@ -174,7 +177,7 @@ The following image should help you understand these overlays:

surface

-

on-surface

+

on-surface

@@ -201,8 +204,9 @@ You can check available Pygments colors on this `pygments demo page `__ for its default syntax highlighting themes. -The accessible pygments themes are designed to meet `WCAG `__ AA or AAA standards for contrast and some themes are also suitable for colorblind users -or low light conditions. You can check all the available styles at the `accessible pygments demo page `__. +The accessible pygments themes are designed to meet `WCAG AA or AAA standards for color contrast `__ and some included themes are also suitable for colorblind users +or low-light conditions. +You can check all the available styles at the `accessible pygments demo page `__. .. danger:: diff --git a/docs/user_guide/theme-elements.md b/docs/user_guide/theme-elements.md index ed43afaea..58d9cff68 100644 --- a/docs/user_guide/theme-elements.md +++ b/docs/user_guide/theme-elements.md @@ -1,7 +1,7 @@ # Theme-specific elements There are a few elements that are unique or particularly important to this theme. -Some of these are triggered with configuration or markdown syntax that is unique to the theme, and we cover them below. +Some of these are triggered with configuration or Markdown syntax that is unique to the theme, and we cover them below. ```{contents} Page contents :local: @@ -9,11 +9,10 @@ Some of these are triggered with configuration or markdown syntax that is unique ## Mathematics -Most Sphinx sites support math, but it is particularly important for scientific computing and so we illustrate support here as well. +Most Sphinx sites support math, but it is particularly important for scientific computing, so we illustrate support here as well. Here is an inline equation: {math}`X_{0:5} = (X_0, X_1, X_2, X_3, X_4)` and {math}`another` and {math}`x^2 x^3 x^4` another. And here's one to test vertical height {math}`\frac{\partial^2 f}{\partial \phi^2}`. - -Here is block-level equation: +Here is a block-level equation: ```{math} :label: My label @@ -45,7 +44,7 @@ And here is a really long equation with a label! \frac{1}{r^2 \sin^2\theta} \frac{\partial^2 f}{\partial \phi^2} ``` -You can add a link to equations like the one above: {eq}`My label` and {eq}`My label 2`. +You can add a link to equations like the one above {eq}`My label` and {eq}`My label 2`. ## Code blocks @@ -58,7 +57,7 @@ print("A regular code block") print("A regular code block") ``` -You can also provide captions with code blocks, which will be displayed just above the code. +You can also provide captions with code blocks, which will be displayed right above the code. For example, the following code: ````md @@ -104,7 +103,7 @@ print("A code block with a caption and line numbers.") ## Inline code -When used directly, the `code` role just displays the text without syntax highlighting, as a literal. As mentioned in the [Sphinx documentation](https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#inline-code-highlighting) you can also enable syntax highlighting by defining a custom role. It will then use the same highligther as in the `code-block` directive. +When used directly, the `code` role just displays the text without syntax highlighting, as a literal. As mentioned in the [Sphinx documentation](https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#inline-code-highlighting) you can also enable syntax highlighting by defining a custom role. It will then use the same highlighter as in the `code-block` directive. ```{code-block} rst @@ -147,13 +146,13 @@ Here's one footnote[^1] and another footnote [^2] and a named footenote[^named], ## Version changes -This theme supports a short-hand way of making **admonitions behave like sidebars**. +This theme supports a shorthand way of making **admonitions behave like sidebars**. This can be a helpful way of highlighting content that lives to the side of your main text without interrupting the vertical flow as much. For example, look to the right of an "admonition sidebar" and a traditional Sphinx sidebar. To make an admonition behave like a sidebar, add the `sidebar` class to its list of classes. -For example, the admonition sidebar was created with the following markdown: +For example, the admonition sidebar was created with the following Markdown: ````md ```{admonition} A sidebar admonition! @@ -169,7 +168,7 @@ Instead of displaying these as raw links, this theme does some lightweight forma In **reStructuredText**, URLs are automatically converted to links, so this works automatically. -In **MyST Markdown**, by default you must define a standard markdown link and duplicate the URL in the link text. +In **MyST Markdown**, by default, you must define a standard Markdown link and duplicate the URL in the link text. You may skip the need to manually define the link text by [activating the MyST Linkify extension](https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#linkify). For example: diff --git a/docs/user_guide/version-dropdown.rst b/docs/user_guide/version-dropdown.rst index 8a9b17cef..7bbf6dcbf 100644 --- a/docs/user_guide/version-dropdown.rst +++ b/docs/user_guide/version-dropdown.rst @@ -7,7 +7,7 @@ switcher will differ depending on which page of the docs is being viewed. For example, on the page ``https://mysite.org/en/v2.0/changelog.html``, the switcher links will go to ``changelog.html`` in the other versions of your docs. When clicked, the switcher will check for the existence of that page, and -if it doesn't exist, redirect to the homepage of that docs version instead. +if it doesn't exist, redirect to the homepage of that docs' version instead. The switcher requires the following configuration steps: @@ -23,7 +23,7 @@ The switcher requires the following configuration steps: 3. Specify where to place the switcher in your page layout. For example, add the ``"version-switcher"`` template to one of the layout lists in - ``html_theme_options`` (e.g., ``navbar_end``, ``footer_start``, etc). + ``html_theme_options`` (e.g., ``navbar_end``, ``footer_start``, etc.). Below is a more in-depth description of each of these configuration steps. @@ -39,7 +39,7 @@ each can have the following fields: ``switcher['version_match']`` to provide styling to the switcher. - ``url``: the URL for this version. - ``name``: an optional name to display in the switcher dropdown instead of the - version string (e.g., "latest", "stable", "dev", etc). + version string (e.g., "latest", "stable", "dev", etc.). Here is an example JSON file: @@ -77,7 +77,7 @@ not specified as a path relative to the sphinx root of the current doc build). Each version of your documentation should point to the same URL, so that as new versions are added to the JSON file all the older versions of the docs will gain switcher dropdown entries linking to the new versions. This could be done -a few different ways: +in a few different ways: - The location could be one that is always associated with the most recent documentation build (i.e., if your docs server aliases "latest" to the most @@ -93,7 +93,7 @@ a few different ways: } } - In this case the JSON is versioned alongside the rest of the docs pages but + In this case, the JSON is versioned alongside the rest of the docs pages but only the most recent version is ever loaded (even by older versions of the docs). @@ -115,7 +115,7 @@ a few different ways: } } -By default the theme is testing the :code:`.json` file provided and outputs warnings in the Sphinx build. If this test breaks the pipeline of your docs, the test can be disabled by configuring the :code:`check_switcher` parameter in :code:`conf.py`: +By default, the theme is testing the :code:`.json` file provided and outputs warnings in the Sphinx build. If this test breaks the pipeline of your docs, the test can be disabled by configuring the :code:`check_switcher` parameter in :code:`conf.py`: .. code-block:: python @@ -132,7 +132,7 @@ being viewed, and is used to style the switcher (i.e., to highlight the current docs version in the switcher's dropdown menu, and to change the text displayed on the switcher button). -Typically you can re-use one of the sphinx variables ``version`` +Typically, you can re-use one of the sphinx variables ``version`` or ``release`` as the value of ``switcher['version_match']``; which one you use depends on how granular your docs versioning is. See `the Sphinx "project info" documentation @@ -229,4 +229,4 @@ version, you could use the following CSS selector: .. seealso:: See the `MDN documentation on dataset properties `_ - for more information on using and styling with these properties. + for more information on using and styling these properties. From 58aceaf6d902cea0d361e98654cd8d150fa1c6db Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Sun, 16 Apr 2023 19:10:01 +0100 Subject: [PATCH 46/64] Minor edits to docs --- docs/_templates/custom-template.html | 2 +- docs/user_guide/keyboard-shortcuts.md | 2 +- docs/user_guide/styling.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_templates/custom-template.html b/docs/_templates/custom-template.html index 0ed45ec1c..f6757f9d4 100644 --- a/docs/_templates/custom-template.html +++ b/docs/_templates/custom-template.html @@ -1,6 +1,6 @@ diff --git a/docs/user_guide/keyboard-shortcuts.md b/docs/user_guide/keyboard-shortcuts.md index 89e67770e..e317f2dca 100644 --- a/docs/user_guide/keyboard-shortcuts.md +++ b/docs/user_guide/keyboard-shortcuts.md @@ -2,7 +2,7 @@ ## Trigger the search bar -You can trigger the search bar pop-up with ctrl/cmd + K. +You can trigger the search bar pop-up with Ctrl/ + K. ## Change pages diff --git a/docs/user_guide/styling.rst b/docs/user_guide/styling.rst index c14d3a473..b20aea03b 100644 --- a/docs/user_guide/styling.rst +++ b/docs/user_guide/styling.rst @@ -13,7 +13,7 @@ Custom CSS Stylesheets ====================== You can customize the theme's CSS by creating a custom stylesheet. This stylesheet will be used by Sphinx while building your site. -Any rules in this style-sheet will over-ride the default theme rules. +Any rules in this style sheet will override the default theme rules. .. seealso:: From c11e0c33403eba96c3345b5c1463616c69127e2d Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Sun, 16 Apr 2023 19:10:37 +0100 Subject: [PATCH 47/64] Fix colour in code blocks --- .../assets/styles/components/_toc-inpage.scss | 3 +++ src/pydata_sphinx_theme/assets/styles/content/_code.scss | 7 ++++--- .../assets/styles/extensions/_sphinx_design.scss | 5 ++++- .../assets/styles/variables/_color.scss | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/components/_toc-inpage.scss b/src/pydata_sphinx_theme/assets/styles/components/_toc-inpage.scss index 2f2fc76ca..f26eb92f4 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_toc-inpage.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_toc-inpage.scss @@ -25,6 +25,9 @@ nav.page-toc { // Each entry of the in-page TOC .toc-entry { display: block; + a > code { + color: var(--pst-color-text-muted); + } a.nav-link { display: block; diff --git a/src/pydata_sphinx_theme/assets/styles/content/_code.scss b/src/pydata_sphinx_theme/assets/styles/content/_code.scss index e1b8d9120..1945d77ad 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_code.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_code.scss @@ -53,7 +53,8 @@ code.literal { background-color: var(--pst-color-surface); border: 1px solid var(--pst-color-border); border-radius: 0.25rem; - a { - color: var(--pst-color-inline-code-links); - } +} + +a > code { + color: var(--pst-color-inline-code-links); } diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 90b1d7afb..534e97631 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -209,7 +209,7 @@ details.sd-dropdown { // Set a variable that we can re-use for colors later // We must set this in the current and content sibling container // so that it is defined in both places - --pst-sd-dropdown-color: var(--sd-color-card-border); + --pst-sd-dropdown-color: var(--pst-gray-500); --pst-sd-dropdown-bg-color: var(--pst-color-surface); & + div.sd-summary-content { --pst-sd-dropdown-color: var(--sd-color-card-border); @@ -245,6 +245,9 @@ details.sd-dropdown { display: inline-flex; align-items: center; color: var(--pst-sd-dropdown-color) !important; + svg { + opacity: 1; + } } // Positioning of the caret diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index dcdf32aa8..77b08cb3a 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -196,7 +196,7 @@ $pst-semantic-colors: ( "inline-code-links": ( // need to make sure there is enough contrast agains the code bg "light": #{map-deep-get($color-palette, "teal", "700")}, - "dark": #{map-deep-get($color-palette, "teal", "300")}, + "dark": #{map-deep-get($color-palette, "teal", "500")}, ), "target": ( "light": #8b6e31, From 6702fc23096c26d148d166bab1f8cb68f17a60cb Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 17 Apr 2023 18:54:12 +0100 Subject: [PATCH 48/64] :zap: Use math.pow - we use dart sass now --- .../assets/styles/abstracts/_mixins.scss | 31 +++---------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index a851aaa33..082d0e9db 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -63,6 +63,8 @@ top: 0; background-color: var(#{$color-variable}); z-index: -1; + // TODO: check for colour contrast bg vs text + // color: #{a11y-combination($color-variable)}; // So that hovering over the text within background is still possible. // Otherwise the background overlays the text and you cannot click or select easily. @@ -168,32 +170,6 @@ @return $dec; } -// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255) -$_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 - 0.0027 0.003 0.0033 0.0037 0.004 0.0044 0.0048 0.0052 0.0056 0.006 0.0065 - 0.007 0.0075 0.008 0.0086 0.0091 0.0097 0.0103 0.011 0.0116 0.0123 0.013 - 0.0137 0.0144 0.0152 0.016 0.0168 0.0176 0.0185 0.0194 0.0203 0.0212 0.0222 - 0.0232 0.0242 0.0252 0.0262 0.0273 0.0284 0.0296 0.0307 0.0319 0.0331 0.0343 - 0.0356 0.0369 0.0382 0.0395 0.0409 0.0423 0.0437 0.0452 0.0467 0.0482 0.0497 - 0.0513 0.0529 0.0545 0.0561 0.0578 0.0595 0.0612 0.063 0.0648 0.0666 0.0685 - 0.0704 0.0723 0.0742 0.0762 0.0782 0.0802 0.0823 0.0844 0.0865 0.0887 0.0908 - 0.0931 0.0953 0.0976 0.0999 0.1022 0.1046 0.107 0.1095 0.1119 0.1144 0.117 - 0.1195 0.1221 0.1248 0.1274 0.1301 0.1329 0.1356 0.1384 0.1413 0.1441 0.147 - 0.15 0.1529 0.1559 0.159 0.162 0.1651 0.1683 0.1714 0.1746 0.1779 0.1812 - 0.1845 0.1878 0.1912 0.1946 0.1981 0.2016 0.2051 0.2086 0.2122 0.2159 0.2195 - 0.2232 0.227 0.2307 0.2346 0.2384 0.2423 0.2462 0.2502 0.2542 0.2582 0.2623 - 0.2664 0.2705 0.2747 0.2789 0.2831 0.2874 0.2918 0.2961 0.3005 0.305 0.3095 - 0.314 0.3185 0.3231 0.3278 0.3325 0.3372 0.3419 0.3467 0.3515 0.3564 0.3613 - 0.3663 0.3712 0.3763 0.3813 0.3864 0.3916 0.3968 0.402 0.4072 0.4125 0.4179 - 0.4233 0.4287 0.4342 0.4397 0.4452 0.4508 0.4564 0.4621 0.4678 0.4735 0.4793 - 0.4851 0.491 0.4969 0.5029 0.5089 0.5149 0.521 0.5271 0.5333 0.5395 0.5457 - 0.552 0.5583 0.5647 0.5711 0.5776 0.5841 0.5906 0.5972 0.6038 0.6105 0.6172 - 0.624 0.6308 0.6376 0.6445 0.6514 0.6584 0.6654 0.6724 0.6795 0.6867 0.6939 - 0.7011 0.7084 0.7157 0.7231 0.7305 0.7379 0.7454 0.7529 0.7605 0.7682 0.7758 - 0.7835 0.7913 0.7991 0.807 0.8148 0.8228 0.8308 0.8388 0.8469 0.855 0.8632 - 0.8714 0.8796 0.8879 0.8963 0.9047 0.9131 0.9216 0.9301 0.9387 0.9473 0.956 - 0.9647 0.9734 0.9823 0.9911 1; - /** * Get color combinations that meet a minimum contrast ratio as per WCAG 2 */ @@ -262,7 +238,8 @@ $_luminance-list: 0.0008 0.001 0.0011 0.0013 0.0015 0.0017 0.002 0.0022 0.0025 $rgb-col: map-merge( $rgb-col, ( - $channel: nth($_luminance-list, $value + 1), + $channel: + math.pow(math.div((math.div($value, 255) + 0.055), 1.055), 2.4), ) ); } From 17b0e35f2a18b745d3ce17360b47709969dbd533 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 17 Apr 2023 19:32:35 +0100 Subject: [PATCH 49/64] :zap: Use math.pow --- .../assets/styles/abstracts/_mixins.scss | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index 082d0e9db..cb915d77d 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -6,7 +6,7 @@ * ref: https://www.nngroup.com/articles/scrolling-and-scrollbars/ */ -// loading the math module +// loading the math module - needed for a11y-combination @use "sass:math"; @mixin scrollbar-style() { @@ -63,13 +63,21 @@ top: 0; background-color: var(#{$color-variable}); z-index: -1; - // TODO: check for colour contrast bg vs text - // color: #{a11y-combination($color-variable)}; - // So that hovering over the text within background is still possible. // Otherwise the background overlays the text and you cannot click or select easily. // ref: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events pointer-events: none; + color: is-color(var(#{$color-variable})); + } +} + +@function is-color($value) { + @if type-of($value) == "color" { + @return #{a11y-combination($value)}; + @debug "is a color: #{$value}✨ "; + } @else { + @debug "not a color: #{$value}"; + @return --pst-color-text-base; } } @@ -100,6 +108,7 @@ /** * Function to check if the color needs converting to a "color" type * if it is a string we cannot use other color manipulation functions +* It is used to create the sphinx-design colours as these are often interpolated */ // @param {String/Color} $color - Color definition from map // @return {Color} - Color type (in hex) @@ -202,7 +211,7 @@ @return $max-ratio-color; } -@function get-contrast-ratio($bg, $foreground: #ced6dd) { +@function get-contrast-ratio($bg, $foreground) { $l1: luminance($bg); $l2: luminance($foreground); From f5f3795e0fa27c54c2cb2dac57467ab40de70073 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 18 Apr 2023 10:02:37 +0100 Subject: [PATCH 50/64] :zap: Update mixins --- .../assets/styles/abstracts/_mixins.scss | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index cb915d77d..feaab5e63 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -67,17 +67,6 @@ // Otherwise the background overlays the text and you cannot click or select easily. // ref: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events pointer-events: none; - color: is-color(var(#{$color-variable})); - } -} - -@function is-color($value) { - @if type-of($value) == "color" { - @return #{a11y-combination($value)}; - @debug "is a color: #{$value}✨ "; - } @else { - @debug "not a color: #{$value}"; - @return --pst-color-text-base; } } From 659eccabda6c1d90bdefd275108f64caf8f78059 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 13 Jun 2023 18:01:20 +0100 Subject: [PATCH 51/64] :heavy_plus_sign: Add math import in mixins --- src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index 39c4af9c8..2eb97d8f5 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -1,6 +1,10 @@ /********************************************* * SASS Mixins *********************************************/ + +// loading the math module +@use "sass:math"; + /** * A consistent box shadow style we apply across elements. */ From 85c14645d566c8919256007654ee70bd2e7373e7 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 13 Jun 2023 19:25:34 +0100 Subject: [PATCH 52/64] Fix highlight colour - pygments --- src/pydata_sphinx_theme/assets/styles/content/_code.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pydata_sphinx_theme/assets/styles/content/_code.scss b/src/pydata_sphinx_theme/assets/styles/content/_code.scss index 1945d77ad..c2d05ac7f 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_code.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_code.scss @@ -58,3 +58,10 @@ code.literal { a > code { color: var(--pst-color-inline-code-links); } + +// Fix for Sphinx's "highlight" directive - this is an issue with our accessible pygments theme +// and the colour we are using for the background of the code blocks. + +html[data-theme="light"] .highlight .nf { + color: #0078a1 !important; +} From 1330c74b4407470b28857bbd39227dd3474dcdb2 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 13 Jun 2023 19:32:39 +0100 Subject: [PATCH 53/64] Fix inline code links contrast --- src/pydata_sphinx_theme/assets/styles/variables/_color.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 77b08cb3a..1cfa10c8a 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -194,9 +194,9 @@ $pst-semantic-colors: ( "dark": #{map-deep-get($color-palette, "pink", "300")}, ), "inline-code-links": ( - // need to make sure there is enough contrast agains the code bg - "light": #{map-deep-get($color-palette, "teal", "700")}, - "dark": #{map-deep-get($color-palette, "teal", "500")}, + // need to make sure there is enough contrast against the code bg + "light": #{map-deep-get($color-palette, "teal", "600")}, + "dark": #{map-deep-get($color-palette, "teal", "400")}, ), "target": ( "light": #8b6e31, From 856657851991bb420ce4b080e73d399d46646713 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 13 Jun 2023 19:46:35 +0100 Subject: [PATCH 54/64] Add selector to print - a11y tests --- tests/test_a11y.py | 2 +- tests/utils/pretty_axe_results.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_a11y.py b/tests/test_a11y.py index e4a6821a0..0f07cea90 100644 --- a/tests/test_a11y.py +++ b/tests/test_a11y.py @@ -111,4 +111,4 @@ def test_axe_core_kitchen_sink( results = page.evaluate(f"axe.run('{selector}')") # Expect Axe-core to have found 0 accessibility violations - assert len(results["violations"]) == 0, pretty_axe_results(results) + assert len(results["violations"]) == 0, pretty_axe_results(results, selector) diff --git a/tests/utils/pretty_axe_results.py b/tests/utils/pretty_axe_results.py index 698d42efd..c5929e087 100644 --- a/tests/utils/pretty_axe_results.py +++ b/tests/utils/pretty_axe_results.py @@ -10,7 +10,7 @@ # assert(len(results["violations"])) == 0, pretty_axe_results(results) -def pretty_axe_results(results: dict) -> str: +def pretty_axe_results(results: dict, selector: str) -> str: """Create readable string that can be printed to console from the Axe-core results object. :param results: The object promised by `axe.run()`. @@ -30,6 +30,7 @@ def pretty_axe_results(results: dict) -> str: ) for tag in violation["tags"]: string += f" {tag}" + string += f"\n\tTested selector: {selector}" string += "\n\tElements Affected:" i = 1 for node in violation["nodes"]: From 181ed571b6a9f39ee27dbc2b26e75e3a8cb83473 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 13 Jun 2023 20:05:26 +0100 Subject: [PATCH 55/64] Fix line numbers contrast --- src/pydata_sphinx_theme/assets/styles/base/_base.scss | 3 ++- src/pydata_sphinx_theme/assets/styles/content/_hacks.scss | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pydata_sphinx_theme/assets/styles/base/_base.scss b/src/pydata_sphinx_theme/assets/styles/base/_base.scss index 12a26ac9c..9970ec12e 100644 --- a/src/pydata_sphinx_theme/assets/styles/base/_base.scss +++ b/src/pydata_sphinx_theme/assets/styles/base/_base.scss @@ -169,7 +169,8 @@ pre { border-radius: $admonition-border-radius; .linenos { - opacity: 0.5; + // minimum opacity to make the line numbers WCAG AA conformant + opacity: 0.8; padding-right: 10px; } } diff --git a/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss b/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss index 054403d8b..c725ba246 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss @@ -14,3 +14,8 @@ div.doctest > div.highlight span.gp { -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE10+ */ } + +// Minimum opacity needed for linenos to be WCAG AA conformant +span.linenos { + opacity: 0.8; +} From 6dedf8e2b29c7e4b0ba5899c78933d8f0d5f339f Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Tue, 13 Jun 2023 20:23:47 +0100 Subject: [PATCH 56/64] Fix announcement link colours --- .../assets/styles/sections/_announcement.scss | 4 ++++ src/pydata_sphinx_theme/assets/styles/variables/_color.scss | 1 + 2 files changed, 5 insertions(+) diff --git a/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss b/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss index aa59a6bf2..34f983c13 100644 --- a/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss +++ b/src/pydata_sphinx_theme/assets/styles/sections/_announcement.scss @@ -33,4 +33,8 @@ &:empty { display: none; } + + a { + color: var(--pst-color-inline-code-links); + } } diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 1cfa10c8a..d5c63b7a1 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -196,6 +196,7 @@ $pst-semantic-colors: ( "inline-code-links": ( // need to make sure there is enough contrast against the code bg "light": #{map-deep-get($color-palette, "teal", "600")}, + // keep primary color for dark mode "dark": #{map-deep-get($color-palette, "teal", "400")}, ), "target": ( From 0f1ffb9f2b6f2f22ffa09dcbfbdf8a12ca316f0e Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Thu, 15 Jun 2023 19:53:19 +0100 Subject: [PATCH 57/64] Adjust background colours - light theme --- .../assets/styles/content/_code.scss | 6 ++++- .../assets/styles/content/_hacks.scss | 5 ----- .../assets/styles/variables/_color.scss | 22 +++++++++---------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/content/_code.scss b/src/pydata_sphinx_theme/assets/styles/content/_code.scss index c2d05ac7f..8f4a264d3 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_code.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_code.scss @@ -61,7 +61,11 @@ a > code { // Fix for Sphinx's "highlight" directive - this is an issue with our accessible pygments theme // and the colour we are using for the background of the code blocks. - html[data-theme="light"] .highlight .nf { color: #0078a1 !important; } + +// Minimum opacity needed for linenos to be WCAG AA conformant +span.linenos { + opacity: 0.8 !important; +} diff --git a/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss b/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss index c725ba246..054403d8b 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_hacks.scss @@ -14,8 +14,3 @@ div.doctest > div.highlight span.gp { -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE10+ */ } - -// Minimum opacity needed for linenos to be WCAG AA conformant -span.linenos { - opacity: 0.8; -} diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index d5c63b7a1..10c8f57d1 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -38,9 +38,9 @@ $color-palette: ( "violet": ( "50": #f4eefb, - "100": #e1cafe, - "200": #cda5ff, - "300": #b680ff, + "100": #e0c7ff, + "200": #d5b4fd, + "300": #b780ff, "400": #9c5ffd, "500": #8045e5, "600": #6432bd, @@ -117,7 +117,7 @@ $foundation-dark-gray: #222832; $pst-semantic-colors: ( "primary": ( "light": #{map-deep-get($color-palette, "teal", "500")}, - "bg-light": #{map-deep-get($color-palette, "teal", "100")}, + "bg-light": #{map-deep-get($color-palette, "teal", "200")}, "dark": #{map-deep-get($color-palette, "teal", "400")}, "bg-dark": #{map-deep-get($color-palette, "teal", "800")}, ), @@ -129,25 +129,25 @@ $pst-semantic-colors: ( ), "accent": ( "light": #{map-deep-get($color-palette, "pink", "500")}, - "bg-light": #{map-deep-get($color-palette, "pink", "100")}, + "bg-light": #{map-deep-get($color-palette, "pink", "200")}, "dark": #{map-deep-get($color-palette, "pink", "400")}, "bg-dark": #{map-deep-get($color-palette, "pink", "800")}, ), "info": ( "light": #276be9, - "bg-light": #eff4fd, + "bg-light": #dce7fc, "dark": #79a3f2, "bg-dark": #06245d, ), "warning": ( "light": #f66a0a, - "bg-light": #fff8f2, + "bg-light": #f8e3d0, "dark": #ff9245, "bg-dark": #652a02, ), "success": ( "light": #00843f, - "bg-light": #ecf6f1, + "bg-light": #d6ece1, "dark": #5fb488, "bg-dark": #002f17, ), @@ -161,7 +161,7 @@ $pst-semantic-colors: ( ), "danger": ( "light": #d72d47, - "bg-light": #fcf1f2, + "bg-light": #f9e1e4, "dark": #e78894, "bg-dark": #4e111b, ), @@ -183,11 +183,11 @@ $pst-semantic-colors: ( ), "border": ( "light": #{map-deep-get($color-palette, "gray", "300")}, - "dark": #{map-deep-get($color-palette, "gray", "500")}, + "dark": #{map-deep-get($color-palette, "gray", "600")}, ), "border-muted": ( "light": rgba(23, 23, 26, 0.2), - "dark": #{map-deep-get($color-palette, "gray", "600")}, + "dark": #{map-deep-get($color-palette, "gray", "700")}, ), "inline-code": ( "light": #{map-deep-get($color-palette, "pink", "600")}, From 4c17a23a97b2fdc520bdc6f7b41e50d88b9ec5cb Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 16 Jun 2023 11:46:54 +0100 Subject: [PATCH 58/64] Update search highlight colours --- src/pydata_sphinx_theme/assets/styles/variables/_color.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss index 10c8f57d1..e658ae062 100644 --- a/src/pydata_sphinx_theme/assets/styles/variables/_color.scss +++ b/src/pydata_sphinx_theme/assets/styles/variables/_color.scss @@ -200,8 +200,8 @@ $pst-semantic-colors: ( "dark": #{map-deep-get($color-palette, "teal", "400")}, ), "target": ( - "light": #8b6e31, - "dark": #c79d41, + "light": #f3cf95, + "dark": #675c04, ), // DEPTH COLORS - you can see the elevation colours and shades // in the Figma file https://www.figma.com/file/rUrrHGhUBBIAAjQ82x6pz9/PyData-Design-system---proposal-for-implementation-(2)?node-id=1492%3A922&t=sQeQZehkOzposYEg-1 From 4687c7dc787a0cbee890dcd80be3285dffa790dd Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 16 Jun 2023 15:19:46 +0100 Subject: [PATCH 59/64] :wheelchair: Change hover colour to improve contrast --- .jupyterlite.doit.db | Bin 0 -> 57344 bytes .../assets/styles/extensions/_copybutton.scss | 1 + 2 files changed, 1 insertion(+) create mode 100644 .jupyterlite.doit.db diff --git a/.jupyterlite.doit.db b/.jupyterlite.doit.db new file mode 100644 index 0000000000000000000000000000000000000000..017884d61ece3a5e0204a951625777b2a11be0d3 GIT binary patch literal 57344 zcmeHQOK+Uld6qPiWyvC$o9x)B8-@m&2C#`{BPXEdBSTD@%7TE!|!EmucTH|M&R{%vWH(0`nD^ufTi-<|{B? zf%yu|S75#Z^A(t{KvP%X@$;9jzjXWd<;T6gD>h@;?)3AoD{p`8-dpeATYmqo-}uVC z<@}Z9U%$CL_R)8}57s+jxgQ_(m%H2ewYRysytCWca=ZJ>AH@CFtG^|v<0AH2>bhT0WoG^BR6#S^7o(>%!9i zF8yLLEWWnzZwp^uxO(N!@)zeH^A(us3jF!b&1;WaKi=BejqAl;XEUs&7~-z$$FPn& z61%<5cDJ|Yw|Dl}@cG)qy`BAj+}(7=`p*8wR_ykBAFZr^=r;FaZ+&fLZTX{v*OyoP zgXlkqyZQ5#-?}T`9(=lje_8!{FYfkM`>xw@t9Q5kUOB|-MyLN^uUOr2eSB+gb!R_c zxI4X_2c7PtJN*Z7E3US?+mBYmw(s59?0gtkdk@@hTs@r5D(3TKw!^QEPI48>qTlhW zTIjZk1rNb{ucH^%=prTCe%QlgzfF}ML@E*)#do_X zgyS-?;Fu0^<$eRilghMdWXU;JI8qc*S}(LAC&eSyG7IS#6PPyT(Q_aZ@#Q8Lm;AC=REW~u0QYAbu zxQ<*%?PwuFU`ZNh3dw3dpF7Tf;5K5_b`fi+;n*oI33hG8B_a!r<0y zD3gp5jo7bVe}6MebK>YxK_LoN`Q$k%aEVl*sF%c%)$NA3VPP{8jsS zV_>lMcU`x)3F~gVTiU5(_UOvG-|nW)#=3vtx*IV-MXdzJqmY)vv|+I7s3kmT7Yf2z zN-!2yCL6IMGx_TEmOd0_4VLYP5mV^GY(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V74SDv2<_~<%!5JGpzl3|&`Y6n*|cr$sFiGw@Afx%x0 z*uCfQ}&RQu#688)>~ kZjxbA`{d4QSJXbyvls@oPjZ4HIrg;IKhX(q^ZkSW1MqFl1ONa4 literal 0 HcmV?d00001 diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_copybutton.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_copybutton.scss index ce8ebb6d0..be6c887f7 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_copybutton.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_copybutton.scss @@ -22,6 +22,7 @@ div.highlight button.copybtn { &:hover { &:not(.success) { color: var(--pst-color-text); + background-color: var(--pst-color-shadow); } } From 9405a855fedee531cc3b01004b9d0c4deb3460b4 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 16 Jun 2023 17:39:07 +0100 Subject: [PATCH 60/64] Update docs to align with system --- docs/user_guide/branding.rst | 3 ++- docs/user_guide/extending.rst | 7 ++++--- docs/user_guide/styling.rst | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/user_guide/branding.rst b/docs/user_guide/branding.rst index 2154b67dd..46e22b0e1 100644 --- a/docs/user_guide/branding.rst +++ b/docs/user_guide/branding.rst @@ -90,7 +90,8 @@ To do so, customize the ``html_teme_options["logo"]["alt_text"]`` configuration html_theme_options = { "logo": { - "alt_text": "foo", + # It is a good practice to indicate where the logo links to using the alt text such as - Home + "alt_text": "foo - Home", } } diff --git a/docs/user_guide/extending.rst b/docs/user_guide/extending.rst index 0bc02a842..1e98f29e3 100644 --- a/docs/user_guide/extending.rst +++ b/docs/user_guide/extending.rst @@ -69,7 +69,7 @@ The title is specified on the same line as the ``.. admonition::`` directive: Styling with semantic color names --------------------------------- -You can re-style any admonition to match any of the built-in admonition types using any of the semantic color names as a class (this is most useful for custom-titled admonitions): +You can re-style any admonition to match any of the built-in admonition types using any of the :ref:`theme's semantic color names ` as a class (this is most useful for custom-titled admonitions): .. begin-example-semantic .. admonition:: Custom title with "warning" style @@ -78,7 +78,7 @@ You can re-style any admonition to match any of the built-in admonition types us Lorem ipsum dolor sit amet, consectetur adipiscing elit. .. end-example-semantic -Note that it updates both the color and the icon. +Note that it updates both the color and the icon. See :doc:`./styling` for a list of all semantic color names. .. tab-set:: @@ -104,7 +104,8 @@ Besides the pre-defined semantic color classes (see previous section) you can al Lorem ipsum dolor sit amet, consectetur adipiscing elit. .. end-example-color -Add the new class to your `custom.css `__ file. As in the example below, be sure to use the same color for ``border-color``, ``background-color``, and ``color`` (the transparency effect is handled automatically by the theme). +To do this, you will need to add a class to your `custom.css `__ file, as in the example below. +Be sure to use the same color for ``border-color`` and ``color`` and a different shade for ``background-color``: .. tab-set:: diff --git a/docs/user_guide/styling.rst b/docs/user_guide/styling.rst index b20aea03b..89ca1eb71 100644 --- a/docs/user_guide/styling.rst +++ b/docs/user_guide/styling.rst @@ -17,7 +17,7 @@ Any rules in this style sheet will override the default theme rules. .. seealso:: - For a more in-depth guide in linking static CSS and JS assets in your site, see {doc}`static_assets`. + For a more in-depth guide in linking static CSS and JS assets in your site, see :doc:`static_assets`. To add a custom stylesheet, follow these steps: @@ -63,9 +63,8 @@ Follow these steps to update the base variables: Note that the theme is defined with `CSS variables `_ and **not** `SASS variables `_. - Refer to the previous section if + Refer to :ref:`the managing themes section in this documentation ` you desire a different behavior between the light and dark theme. -.. TODO: add correct reference to light and dark theme @trallard For a complete list of the theme variables that you may override, see the `theme variables defaults CSS file `_: @@ -85,6 +84,8 @@ For a complete list of the theme variables that you may override, see the .. literalinclude:: ../../src/pydata_sphinx_theme/assets/styles/variables/_versionmodified.scss :language: scss +.. _color-variables: + Color variables --------------- From c0e54db5dd5ae9bfec74d6063ae7f25bce1d2c4f Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 19 Jun 2023 11:33:48 +0100 Subject: [PATCH 61/64] :see_no_evil: Update gitignore file --- .gitignore | 3 +++ .jupyterlite.doit.db | Bin 57344 -> 0 bytes 2 files changed, 3 insertions(+) delete mode 100644 .jupyterlite.doit.db diff --git a/.gitignore b/.gitignore index 8483ed852..a4d763580 100644 --- a/.gitignore +++ b/.gitignore @@ -121,3 +121,6 @@ profile.svg # Compiled translation files (are compiled at build time) src/pydata_sphinx_theme/locale/*/*/*.mo + +# jupyterlite db +.jupyterlite.doit.db diff --git a/.jupyterlite.doit.db b/.jupyterlite.doit.db deleted file mode 100644 index 017884d61ece3a5e0204a951625777b2a11be0d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 57344 zcmeHQOK+Uld6qPiWyvC$o9x)B8-@m&2C#`{BPXEdBSTD@%7TE!|!EmucTH|M&R{%vWH(0`nD^ufTi-<|{B? zf%yu|S75#Z^A(t{KvP%X@$;9jzjXWd<;T6gD>h@;?)3AoD{p`8-dpeATYmqo-}uVC z<@}Z9U%$CL_R)8}57s+jxgQ_(m%H2ewYRysytCWca=ZJ>AH@CFtG^|v<0AH2>bhT0WoG^BR6#S^7o(>%!9i zF8yLLEWWnzZwp^uxO(N!@)zeH^A(us3jF!b&1;WaKi=BejqAl;XEUs&7~-z$$FPn& z61%<5cDJ|Yw|Dl}@cG)qy`BAj+}(7=`p*8wR_ykBAFZr^=r;FaZ+&fLZTX{v*OyoP zgXlkqyZQ5#-?}T`9(=lje_8!{FYfkM`>xw@t9Q5kUOB|-MyLN^uUOr2eSB+gb!R_c zxI4X_2c7PtJN*Z7E3US?+mBYmw(s59?0gtkdk@@hTs@r5D(3TKw!^QEPI48>qTlhW zTIjZk1rNb{ucH^%=prTCe%QlgzfF}ML@E*)#do_X zgyS-?;Fu0^<$eRilghMdWXU;JI8qc*S}(LAC&eSyG7IS#6PPyT(Q_aZ@#Q8Lm;AC=REW~u0QYAbu zxQ<*%?PwuFU`ZNh3dw3dpF7Tf;5K5_b`fi+;n*oI33hG8B_a!r<0y zD3gp5jo7bVe}6MebK>YxK_LoN`Q$k%aEVl*sF%c%)$NA3VPP{8jsS zV_>lMc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kDwL-e z7G#+ow-8m6C=@jq0?r?}sKx9%M4am#n6#A&Re^XD&=n|a8xL#O5wM(s!PuktS)ra3 zoHF3#^wfkndyc{iIZr>b!!V74SDv2<_~<%!5JGpzl3|&`Y6n*|cr$sFiGw@Afx%x0 z*uCfQ}&RQu#688)>~ kZjxbA`{d4QSJXbyvls@oPjZ4HIrg;IKhX(q^ZkSW1MqFl1ONa4 From e5830a28fb760cc15688fcfa4dc4e8a4600225d7 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 19 Jun 2023 12:05:25 +0100 Subject: [PATCH 62/64] Apply suggestions from code review Co-authored-by: Daniel McCloy --- docs/community/practices/versions.md | 2 +- docs/community/topics/bootstrap.rst | 2 +- docs/user_guide/accessibility.rst | 11 +++++------ docs/user_guide/branding.rst | 6 +++--- docs/user_guide/fonts.rst | 2 +- docs/user_guide/header-links.rst | 4 ++-- docs/user_guide/keyboard-shortcuts.md | 2 +- docs/user_guide/layout.rst | 2 +- docs/user_guide/light-dark.rst | 2 +- docs/user_guide/navigation.rst | 2 +- docs/user_guide/styling.rst | 6 +++--- docs/user_guide/version-dropdown.rst | 2 +- 12 files changed, 21 insertions(+), 22 deletions(-) diff --git a/docs/community/practices/versions.md b/docs/community/practices/versions.md index 917d08e2a..18d7a7364 100644 --- a/docs/community/practices/versions.md +++ b/docs/community/practices/versions.md @@ -14,7 +14,7 @@ We define "support" as testing against each of these versions so that users can For example, if we made a minor release tomorrow, we'd [look at the EOL schedule for Python](https://endoflife.date/python) and support all the versions that fall within a 3.5-year window. [^1]: Our support for Python versions is inspired by [NEP 029](https://numpy.org/neps/nep-0029-deprecation_policy.html). -[^2]: These policies are goals, but no promises. We are a volunteer-led community with limited time. Consider these sections to be our intention, but we recognize that we may not always be able to meet these criteria if we cannot do so. We welcome contributions from others to help us more sustainably meet these goals! +[^2]: These policies are goals, not promises. We are a volunteer-led community with limited time. Consider these sections to be our intention, but we recognize that we may not always be able to meet these criteria if we cannot do so. We welcome contributions from others to help us more sustainably meet these goals! ## Supported Sphinx versions diff --git a/docs/community/topics/bootstrap.rst b/docs/community/topics/bootstrap.rst index 3a61ef249..c8e87aa6b 100644 --- a/docs/community/topics/bootstrap.rst +++ b/docs/community/topics/bootstrap.rst @@ -57,4 +57,4 @@ Utilities JavaScript ^^^^^^^^^^ -- Data attributes for all JavaScript plugins are now name spaced to help distinguish Bootstrap functionality from third parties and your code. For example, we use ``data-bs-toggle`` instead of ``data-toggle``. +- Data attributes for all JavaScript plugins are now namespaced to help distinguish Bootstrap functionality from third parties and your code. For example, we use ``data-bs-toggle`` instead of ``data-toggle``. diff --git a/docs/user_guide/accessibility.rst b/docs/user_guide/accessibility.rst index 09e616fba..5e4a26d00 100644 --- a/docs/user_guide/accessibility.rst +++ b/docs/user_guide/accessibility.rst @@ -66,7 +66,7 @@ identify if the content is in a language the reader understands. .. Hint:: - Specifying a ``language`` will propagate to the top-level `HTML` tag. + Specifying a ``language`` will propagate to the top-level ``HTML`` tag. .. code-block:: Python @@ -114,7 +114,7 @@ If you have a logo, you can add alt-text to it by adding the following to your "alt_text": "PyData Theme home", }, -Note the use of `home` to indicate that the logo is also a link to the home page. +Note the use of "home" in the alt text to indicate that the logo is also a link to the home page. In the Browser ============== @@ -128,10 +128,9 @@ Built-in tools Most major browsers, including `Firefox `__ -and `Chrome `__ -include significant accessibility tooling in their development experience. Exploring -these, and the modes they offer can help to quickly pinpoint issues and often -include links to standards. +and `Chrome `__, +have accessibility tools built-in as part of their web developer tools. +These tools can help to quickly identify accessibility issues and often include links to standards. tota11y diff --git a/docs/user_guide/branding.rst b/docs/user_guide/branding.rst index 46e22b0e1..43402e8b6 100644 --- a/docs/user_guide/branding.rst +++ b/docs/user_guide/branding.rst @@ -83,15 +83,15 @@ Customize logo alternative text You may set a custom ``alt text`` for your logo to replace the default ``"logo image"`` generic description. Adding a descriptive ``alt text`` can help make your documentation more accessible to readers using screen readers or another assistive tech. -To do so, customize the ``html_teme_options["logo"]["alt_text"]`` configuration option as in the following example: +To do so, customize the ``html_theme_options["logo"]["alt_text"]`` configuration option as in the following example: .. code-block:: python :caption: conf.py html_theme_options = { "logo": { - # It is a good practice to indicate where the logo links to using the alt text such as - Home - "alt_text": "foo - Home", + # Because the logo is also a homepage link, including "home" in the alt text is good practice + "alt_text": "My Project Name - Home", } } diff --git a/docs/user_guide/fonts.rst b/docs/user_guide/fonts.rst index 0b36f3f94..eafb4b323 100644 --- a/docs/user_guide/fonts.rst +++ b/docs/user_guide/fonts.rst @@ -9,7 +9,7 @@ available system fonts for normal body text and headers. The default body and header fonts can be changed as follows: -- Using:ref:`custom-css`, you can specify which fonts to use for the body, header, +- Using :ref:`custom-css`, you can specify which fonts to use for the body, header, and monospaced text. For example, the following can be added to a custom CSS file: diff --git a/docs/user_guide/header-links.rst b/docs/user_guide/header-links.rst index be2e72238..6b410f1ce 100644 --- a/docs/user_guide/header-links.rst +++ b/docs/user_guide/header-links.rst @@ -30,7 +30,7 @@ It will place the remaining header links in a **dropdown menu** titled "More". This prevents the header links from taking up so much space that they crowd out the UI components or spill off-screen. To control how many header links are displayed before being placed in the dropdown, use the ``header_links_before_dropdown`` theme configuration variable. -For example, to change the number of displayed header links to be ``4`` instead of ``5``:abbr: +For example, to change the number of displayed header links to be ``4`` instead of ``5``: .. code-block:: python @@ -116,7 +116,7 @@ Here are several examples: "name": "Twitter", "url": "https://twitter.com/", "icon": "fa-brands fa-square-twitter", - # The default for `type` is `fontawesome`, so it is not required in any of the above examples as it shown here + # The default for `type` is `fontawesome`, so it is not required in the above examples }, { "name": "Mastodon", diff --git a/docs/user_guide/keyboard-shortcuts.md b/docs/user_guide/keyboard-shortcuts.md index e317f2dca..c163d47d4 100644 --- a/docs/user_guide/keyboard-shortcuts.md +++ b/docs/user_guide/keyboard-shortcuts.md @@ -2,7 +2,7 @@ ## Trigger the search bar -You can trigger the search bar pop-up with Ctrl/ + K. +You can trigger the search bar pop-up with {kbd}`Ctrl`/{kbd}`⌘` + {kbd}`K`. ## Change pages diff --git a/docs/user_guide/layout.rst b/docs/user_guide/layout.rst index 8f3596fd8..018f32679 100644 --- a/docs/user_guide/layout.rst +++ b/docs/user_guide/layout.rst @@ -212,7 +212,7 @@ Templates and components ======================== There are a few major theme sections that you can customize to add/remove -components or add your components. Each section is configured with a +built-in components or add your own components. Each section is configured with a list of *HTML templates* — these are snippets of HTML that are inserted into the section by Sphinx. diff --git a/docs/user_guide/light-dark.rst b/docs/user_guide/light-dark.rst index 58d64ed0d..bfb6ea88f 100644 --- a/docs/user_guide/light-dark.rst +++ b/docs/user_guide/light-dark.rst @@ -4,7 +4,7 @@ Light and dark themes ===================== -You can change the major background/foreground colors of this theme according to the "dark" and "light" modes. +You can change the major background/foreground colors of this theme using built-in "dark" and "light" modes. These are controlled by a button in the navigation header, with the following options: - A ``light`` theme with a bright background and dark text / UI elements diff --git a/docs/user_guide/navigation.rst b/docs/user_guide/navigation.rst index 8d219d5b4..ee59cb424 100644 --- a/docs/user_guide/navigation.rst +++ b/docs/user_guide/navigation.rst @@ -3,7 +3,7 @@ Navigation depth and collapsing sidebars ======================================== -By default, this theme enables to expand/collapse of subsections in the primary +By default, this theme allows expanding/collapsing subsections in the primary sidebar navigation (without actually navigating to the page itself), and this extends up to 4 levels deep: diff --git a/docs/user_guide/styling.rst b/docs/user_guide/styling.rst index 89ca1eb71..3e2df90a2 100644 --- a/docs/user_guide/styling.rst +++ b/docs/user_guide/styling.rst @@ -63,7 +63,7 @@ Follow these steps to update the base variables: Note that the theme is defined with `CSS variables `_ and **not** `SASS variables `_. - Refer to :ref:`the managing themes section in this documentation ` + Refer to :ref:`the managing themes section in this documentation ` if you desire a different behavior between the light and dark theme. For a complete list of the theme variables that you may override, see the @@ -119,7 +119,7 @@ Here is an overview of the colors available in the theme (change theme mode to s

primary secondary - secondary + accent success info warning @@ -128,7 +128,7 @@ Here is an overview of the colors available in the theme (change theme mode to s on-background surface on-surface - target + target

diff --git a/docs/user_guide/version-dropdown.rst b/docs/user_guide/version-dropdown.rst index 7bbf6dcbf..2502a99c4 100644 --- a/docs/user_guide/version-dropdown.rst +++ b/docs/user_guide/version-dropdown.rst @@ -7,7 +7,7 @@ switcher will differ depending on which page of the docs is being viewed. For example, on the page ``https://mysite.org/en/v2.0/changelog.html``, the switcher links will go to ``changelog.html`` in the other versions of your docs. When clicked, the switcher will check for the existence of that page, and -if it doesn't exist, redirect to the homepage of that docs' version instead. +if it doesn't exist, will redirect to the homepage instead (in the requested version of the docs). The switcher requires the following configuration steps: From 559b1f789df45b1ce7783f3d02e64840ce3d14b8 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 19 Jun 2023 14:36:22 +0100 Subject: [PATCH 63/64] :bug: Use correct variable names --- .../assets/styles/content/_admonitions.scss | 2 +- .../assets/styles/extensions/_sphinx_design.scss | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss b/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss index e1822c721..a71490580 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss @@ -162,7 +162,7 @@ div.admonition, border-color: var(--pst-color-attention); > .admonition-title { &:before { - background-color: var(--pst-color-warning-bg); + background-color: var(--pst-color-attention-bg); } &:after { diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 534e97631..c18935846 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -69,12 +69,12 @@ $all-colors: map-merge($pst-semantic-colors, $extra-semantic-colors); // we are now using a11y-combination to calculate the text color - this is based // on the WCAG color contrast guidelines --pst-color-#{$name}-text: #{a11y-combination($value)}; - // // TODO: check where highlight is used + //TODO: highlight seems to be used for buttons @trallard to fix on a11y follow-up work --pst-color-#{$name}-highlight: #{darken($value, 15%)}; // override the sphinx-design variables --sd-color-#{$name}: var(--pst-color-#{$name}); --sd-color-#{$name}-text: var(--pst-color-#{$name}-text); - // TODO: check where highlight is used + //TODO: highlight seems to be used for buttons @trallard to fix on a11y follow-up work --sd-color-#{$name}-highlight: var(--pst-color-#{$name}-highlight); } From d3cdc27463c75202dabb0046b78a46171778f36b Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 19 Jun 2023 19:50:26 +0100 Subject: [PATCH 64/64] Fix title colour in custom admonitions --- docs/_static/custom.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 9c7671efe..dea2ff828 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -33,6 +33,9 @@ div.admonition.admonition-olive > .admonition-title:before { div.admonition.admonition-olive > .admonition-title:after { color: hsl(60, 100%, 25%); } +div.admonition.admonition-olive > .admonition-title { + color: white; +} /* end-custom-color */ /* begin-custom-icon/* /custom.css */ @@ -54,4 +57,7 @@ div.admonition.admonition-youtube > .admonition-title:after { color: hsl(0, 100%, 50%); content: "\f26c"; /* fa-solid fa-tv */ } +div.admonition.admonition-youtube > .admonition-title { + color: white; +} /* end-custom-youtube */