freenode / web-7.0

The freenode website, home to our blog, knowledge base and policies
https://freenode.net/
Other
116 stars 91 forks source link

Add darkness #483

Closed supertassu closed 3 years ago

supertassu commented 3 years ago

Add dark mode support using prefers-color-scheme: dark CSS media query.

Explicitly set default background color in addition to text color in case any browser has non-black-on-white defaults.

Screenshots ![Home page](https://user-images.githubusercontent.com/9721638/106169285-e2535480-6197-11eb-9266-72a9c0b192e3.png) ![Group management page, showing footer](https://user-images.githubusercontent.com/9721638/106169359-f7c87e80-6197-11eb-93b6-e1d481e546e3.png) ![User modes page, showing a table](https://user-images.githubusercontent.com/9721638/106169447-0e6ed580-6198-11eb-863a-c76881035a15.png)

closes #481

supertassu commented 3 years ago

force pushed since I made a typo in the commit message and wanted to correct it :(

edk0 commented 3 years ago

It pains me to suggest adding yet another colour to the palette, but maybe link text could be a little lighter in dark mode?

supertassu commented 3 years ago

How does this look: image

    --link-color-dark:        #00c8e8;
    --link-hover-color-dark:  #21a9c1;
swantzter commented 3 years ago

I don't know how well our postcss setup handles it, but I prefer changing variable values rather than the actual styles with media queries, for example

:root {
  --bg-color: #fff;
} 

@media (prefers-color-scheme: dark)
  :root {
    --bg-color: #000;
  }
}

this way you're very explicitly changing the palette, not the actual styles

supertassu commented 3 years ago

@swantzter I didn't even realize that was possible, I'll adjust the patch tomorrow.

supertassu commented 3 years ago

{{done}}

swantzter commented 3 years ago

I'm not sure you wanted --c-light as the border colour of the header? image

supertassu commented 3 years ago

Fixed, thanks, also rebased against main.

swantzter commented 3 years ago

Hi sorry for not having had time to have a second look yet.

I have one last concern about tables (and less so about code-blocks/inline code) where I'm wondering if there's enough contrast between the body background and the row/element background. it's sometimes hard for me to distinguish table rows here, or code blocks.

I'm not sure what colour would be better, I might be able to experiment a little the next 5 minutes

swantzter commented 3 years ago

how would you feel about --c-shadow: var(--c-bg-light); in dark mode combined with changing tr:nth-child(odd)to tr:nth-child(even) on L349?

supertassu commented 3 years ago

how would you feel about --c-shadow: var(--c-bg-light); in dark mode combined with changing tr:nth-child(odd)to tr:nth-child(even) on L349?

@swantzter works for me, done in 616c533

swantzter commented 3 years ago

@supertassu awesome, can I make one last little request? in dark mode can we use the same box-shadow for the footer as we do for the navbar?

swantzter commented 3 years ago

or I should perhaps try that out myself first to see if it looks good. that shadow just feels a a little light to me

swantzter commented 3 years ago

okay after testing I feel like rgba(70, 70, 70, 0.5) looks better in dark mode for the footer

supertassu commented 3 years ago

@swantzter footer shadow color is also done now

swantzter commented 3 years ago

Thanks a lot @supertassu for making this PR!