Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark mode #200

Closed
CatalinFrancu opened this issue Dec 21, 2020 · 6 comments
Closed

Dark mode #200

CatalinFrancu opened this issue Dec 21, 2020 · 6 comments
Assignees
Labels
frontend user-visible code (Smarty, Javascript, CSS) time: 2-10 hours time needed

Comments

@CatalinFrancu
Copy link
Member

CatalinFrancu commented Dec 21, 2020

Because one can never have enough glitter! See for example Duck Duck Go, which obeys the browser's dark mode setting.

See prefers-color-scheme.

@CatalinFrancu CatalinFrancu added frontend user-visible code (Smarty, Javascript, CSS) time: 2-10 hours time needed labels Dec 21, 2020
@CatalinFrancu CatalinFrancu added the wontfix This will not be worked on label Jan 15, 2021
@CatalinFrancu
Copy link
Member Author

We decided to put this on hold until Bootstrap adds support for this (likely in v6).

Without it we cannot, for example, do this:

:root {
  --link-color: blue;
}

@media (prefers-color-scheme: dark) {
  :root {
    --link-color: red;
  }
}

$link-color: var(--link-color);

because then $link-hover-color tries to call a function on a not-yet-defined color:

Error: argument `$color` of `darken($color, $amount)` must be a color
        on line 178:43 of www/scss/third-party/bootstrap/_variables.scss, in function `darken`
        from line 178:43 of www/scss/third-party/bootstrap/_variables.scss
        from line 9:9 of www/scss/third-party/bootstrap/bootstrap.scss
        from line 53:9 of www/scss/main.scss
>> $link-hover-color:                        darken($link-color, 15%) !default;

@CatalinFrancu CatalinFrancu reopened this Sep 3, 2021
CatalinFrancu added a commit that referenced this issue Sep 3, 2021
CatalinFrancu added a commit that referenced this issue Sep 3, 2021
@sandriu sandriu removed the wontfix This will not be worked on label Sep 13, 2021
CatalinFrancu added a commit that referenced this issue Sep 13, 2021
@sandriu
Copy link
Member

sandriu commented Sep 13, 2021

Here's the list of colours used in the UI and their assignment per components, in light theme and dark theme (WIP). See Google Material Design Color system for terminology.

Comparison between Light and dark theme.pdf

BELOW tables are updated.

Light theme:

type of colour HEX value known as used on these components observations
primary #232429 "earthy black", custom hero section, global nav menu used only on big main areas
secondary #0d6efd blue, 'Bootstrap primary button' background colour for primary buttons, outline colour for secondary buttons, links, some icons used only on action areas
primary variant #495057 lighter "earthy black" headings, body text
secondary variant #4d87ff lighter blue, based on 'Bootstrap primary button' not currently used this value SHOULD replace the default blue for tags (#1e83c2)
background #FFFFFF white background colour for all pages
surface #FFFFFF white background colour for statements cards, dashboard cards in case we add some depth for these cards, then the surface colour will change
error #F8D7DA light red, "Bootstrap danger alert" background for error messages
on primary #f3e6d7 butter (custom), aka "pinky beige" text on global nav menu, headings placed on 'earthy black' areas
on secondary #FFFFFF white text on 'Bootstrap primary buttons'
on background #495057 lighter "earthy black" ??
on surface #495057 lighter "earthy black" ??
on error #721c24 red, "Bootstrap danger alert" text on error areas not used?
alternative grey #eee light grey "no verdict" card
alternative darker grey #aaa medium grey "undecidable" verdict card
alternative red #d90404 red "false" verdict card
alternative red-yellow gradient from #d90404 to #ffeb3b gradient "in general false" verdict card
alternative yelow #ffeb3b yellow "mixt" verdict card
alternative green-yellow gradient from #37700a to #ffeb3b gradient "in general true" verdict card
alternative green #37700a green "true" verdict card

Dark theme:

type of colour HEX value known as used on these components observations
background #232429 "earthy black", custom background for all pages, INCLUDING hero section 'earthy black' is NOT the primary colour anymore (as in Light theme)
surface #303035 lighter "earthy black" not used yet SHOULD be used on global nav menu
primary #599AFD desaturated blue, derived from 'Bootstrap primary button' not used yet this colour MUST REPLACE the current blue (#0d6efd) used for links, for example, because that colour fails WCAG AA standard for accessibility
secondary #C9BCAE desaturated 'butter', aka medium beige not used yet should be used on secondary buttons
primary variant #4273BD darker primary not used yet ok with WCAG AA when used with WHITE text
secondary variant #8A8178 darker secondary not used yet ok with WCAG AA when used with BLACK text
error #FF7579 desaturated red, derived from 'error red' from Light theme text for error messages passes WCAG AA standard when used on #232429 and #303035 areas
on primary #232429 "earthy black" not used yet on #599AFD areas to be used for text on primary buttons; passes WCAG AA standard when used on #599AFD areas
on secondary #232429 "earthy black" not used yet on #C9BCAE areas to be used for text on secondary buttons; passes WCAG AA standard when used on #C9BCAE areas
on background #c4c5c6 light grey body text, already in used passes WCAG AA standard when used on #232429 areas
on surface #c4c5c6 light grey body text, already in used passes WCAG AA standard when used on #303035 areas
on error #232429 "earthy black", custom text only (not areas); not used yet on #FF7579 areas passes WCAG AA standard when used on #FF7579 areas
alternative grey #303035 lighter "earthy black" "no verdict" card
alternative darker grey #3c3c42 even lighter "earthy black" "undecidable" verdict card
alternative red #5d1717 desaturated red "false" verdict card
alternative red-yellow gradient from #5d1717 to #b7a92d gradient "in general false" verdict card
alternative yelow #b7a92d desaturated yellow "mixt" verdict card
alternative green-yellow gradient from #285206 to #b7a92d gradient "in general true" verdict card
alternative green #285206 desaturated green "true" verdict card

@CatalinFrancu
Copy link
Member Author

In case it helps, here are all the existing uses of Bootstrap's theme colors.

success, info, light, dark: unused

We don't use these. I actually removed them from the Bootstrap CSS.

butter (our custom color)

  • home page (e.g. "Contribute" header)
  • navbar (including its dropdowns)

primary

  • many buttons and outline buttons

secondary

  • many buttons and outline buttons
  • statement region badge
  • answer verdict badge
  • user reputation badge on navbar
  • deleted answers and comments

danger

  • many outline buttons
  • feedback for invalid form data
    • this includes some icons on the nav pills on the help page / help category edit pages
  • deleted statements and entities
  • review resolution: delete (e.g. when viewing a deleted object's version history)
  • notification and review icons on the navbar
  • remaining chars on fields with size limit (this shouldn't happen with normal use)

warning

  • closed (e.g. as duplicates) statements and answers
  • editing statements, answers and entities when you can only suggest edits (you can test it with a reputation of 1,000)
  • viewing statements and entities with pending edits
  • review page, e.g. when the object is a duplicate
  • draft indicator
  • fake login button (in development only)
  • date picker clear button

CatalinFrancu added a commit that referenced this issue Oct 14, 2021
CatalinFrancu added a commit that referenced this issue Oct 14, 2021
CatalinFrancu added a commit that referenced this issue Oct 14, 2021
CatalinFrancu added a commit that referenced this issue Oct 14, 2021
CatalinFrancu added a commit that referenced this issue Oct 14, 2021
@CatalinFrancu
Copy link
Member Author

Is the white background a way to warn the user that he/she is using a previously used value?

Yes, apparently that is Chrome/Chromium's autocomplete feature. I managed to style it using this hack.

CatalinFrancu added a commit that referenced this issue Oct 22, 2021
* [#200] Brute force dark mode.

* [#200] Add dark mode for toasts.

* [#200] Add dark mode to Select2-Bootstrap5.

* [#200] Tweak navbar shade in dark mode.

* [#200] Stop using the -light qualifiers.

* [#200] Remove competing CSS classes.

* [#200] Introduce complementary shades.

* [#200] Use complementary shades in main.css.

* [#200] Adapt EasyMDE to dark mode.

* [#200] Finish using the complementary shades var(--c-...).

* [#200] Use color-scheme meta tag.

* [#200] Fix toast vertical spacing.

* [#200] Add a Javascript dark mode toggle.

* [#200] Fix verdict colors.

* [#200] Remove unused Bootstrap components.

* [#200] Remove unused theme colors.

* [#200] Fix for navbar butter color.

* [#200] Bootstrap theme for dark mode, v0.1.

* [#200] Convert some colors to the BS gray scale.

* [#200] Dark mode as a difference between Bootstrap themes.

* [#200] Minor fixes.

* [#200] Select2 tweaks.

* [#200] Proper Select2 theming. Other minor fixes.

* [#200] Remove some uses of var(--c-xxx).

* [#200] Rewrite grayscale as HSL.

* [#200] main.css tweaks.

* [#200] Finish moving theme stuff into main-{light,dark}.scss.

* [#200] Fix main page glitch.

* [#200] EasyMDE button hover color.

* [#200] Verdict colors for dark mode.

* [#200] Fix verdict border and color.

* [Fixes #286] Add label to blank <option>.

* Rebase dark-mode onto master.

* [#200] Implement our own alerts.

* [#200] Fix user link CSS.

* [#200] Horrible horrible hack for Chrome's autocomplete style.

* [#200] Replace uses of the BS warning theme color.
@sandriu sandriu reopened this Nov 10, 2021
@sandriu
Copy link
Member

sandriu commented Nov 10, 2021

I changed 3 colours in the Dark theme and 1 colour in the Light theme, see below PDFs:

Comparison between Light and dark theme - v2.pdf
Dignitas - Light & Dark theme v2.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend user-visible code (Smarty, Javascript, CSS) time: 2-10 hours time needed
Projects
None yet
Development

No branches or pull requests

2 participants