Dark/light mode toggle on the header bar #2

Open
deadvey wants to merge 4 commits from deadvey/javalsais-website:master into master
First-time contributor

You'll want to test this, idk how to with that funky #include thingy.

You'll want to test this, idk how to with that funky #include thingy.
deadvey added 4 commits 2024-10-10 00:17:01 +02:00
Owner

naw, not JS, also dont wanna bloat it to much, might make the toggle text or an SVG. And it should just change CSS root variables,like the colorscheme and that....

naw, not JS, also dont wanna bloat it to much, might make the toggle text or an SVG. And it should just change CSS root variables,like the colorscheme and that....
Author
First-time contributor

You can do that without Javascript?

You can do that without Javascript?
Owner

Not sure, I'm not willing to make it a post request as it is nginx, so idk if there's another way... in any case is very minimal, but I don't wanna have to bother about complex ui things, so I'll try to integrate this as minimalistically as possible

Not sure, I'm not willing to make it a post request as it is nginx, so idk if there's another way... in any case is very minimal, but I don't wanna have to bother about complex ui things, so I'll try to integrate this as minimalistically as possible
Author
First-time contributor

Nice.

Nice.
deadvey closed this pull request 2024-10-12 15:16:31 +02:00
Owner

naw, theres no need to close, I can merge it, I just wanna polish it a lil bit when I get some time

naw, theres no need to close, I can merge it, I just wanna polish it a lil bit when I get some time
Author
First-time contributor

Oh alr, cool.

Oh alr, cool.
deadvey reopened this pull request 2024-10-15 23:38:46 +02:00
Author
First-time contributor

Seems like you can do it without css, it wouldn't have a button but can use the system choice
@media (prefers-color-scheme: dark) {
/* Dark theme styles go here /
}

@media (prefers-color-scheme: light) {
/
Light theme styles go here */
}
source: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/

Seems like you can do it without css, it wouldn't have a button but can use the system choice @media (prefers-color-scheme: dark) { /* Dark theme styles go here */ } 
 @media (prefers-color-scheme: light) { /* Light theme styles go here */ } source: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/
Author
First-time contributor

Gonna add this to my website actually

Gonna add this to my website actually
Owner

Seems like you can do it without css, it wouldn't have a button but can use the system choice
@media (prefers-color-scheme: dark) {
/* Dark theme styles go here /
}

@media (prefers-color-scheme: light) {
/
Light theme styles go here */
}
source: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/

no manual override tho, gonna need either JS or cookies. Still, if I don't do cookies cuz too overkill for a nginx static website, worst case is having the same website style as now with JS disabled. It's pretty much 5 lines of JS anyways.

> Seems like you can do it without css, it wouldn't have a button but can use the system choice > @media (prefers-color-scheme: dark) { > /* Dark theme styles go here */ > } > 
 > @media (prefers-color-scheme: light) { > /* Light theme styles go here */ > } > source: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/ no manual override tho, gonna need either JS or cookies. Still, if I don't do cookies cuz too overkill for a nginx static website, worst case is having the same website style as now with JS disabled. It's pretty much 5 lines of JS anyways.
Owner

Seems like you can do it without css, it wouldn't have a button but can use the system choice
@media (prefers-color-scheme: dark) {
/* Dark theme styles go here /
}

@media (prefers-color-scheme: light) {
/
Light theme styles go here */
}
source: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/

no manual override tho, gonna need either JS or cookies. Still, if I don't do cookies cuz too overkill for a nginx static website, worst case is having the same website style as now with JS disabled. It's pretty much 5 lines of JS anyways.

btw, gotta fix quotes with the custom gitea theme

> > Seems like you can do it without css, it wouldn't have a button but can use the system choice > > @media (prefers-color-scheme: dark) { > > /* Dark theme styles go here */ > > } > > 
 > > @media (prefers-color-scheme: light) { > > /* Light theme styles go here */ > > } > > source: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/ > > no manual override tho, gonna need either JS or cookies. Still, if I don't do cookies cuz too overkill for a nginx static website, worst case is having the same website style as now with JS disabled. It's pretty much 5 lines of JS anyways. btw, gotta fix quotes with the custom gitea theme
Author
First-time contributor

Your website obviously, but I think @media would be fine for most people, you can also set it so it the person has 'no-preference' then that is the same as dark mode, so dark mode is default, only if the person activley choose light mode on their browser it makes it light (I think).
idk

Your website obviously, but I think @media would be fine for most people, you can also set it so it the person has 'no-preference' then that is the same as dark mode, so dark mode is default, only if the person activley choose light mode on their browser it makes it light (I think). idk
Author
First-time contributor

Having said that, my website is loading the light version when my browser is set to dark, could be a mistake in my code though...

Having said that, my website is loading the light version when my browser is set to dark, could be a mistake in my code though...
Owner

Having said that, my website is loading the light version when my browser is set to dark, could be a mistake in my code though...

Set the dark mode without any media and put a light one after, some browser might not support the media thing and that will ensure dark as base and light as an "override".

Also, tor for example sends light mode to all websites to avoid fingerprinting, so there can be a browser setting or simply a typo in CSS, idk, check that.

> Having said that, my website is loading the light version when my browser is set to dark, could be a mistake in my code though... Set the dark mode without any media and put a light one after, some browser might not support the media thing and that will ensure dark as base and light as an "override". Also, tor for example sends light mode to all websites to avoid fingerprinting, so there can be a browser setting or simply a typo in CSS, idk, check that.
Author
First-time contributor

:O

:O
This pull request has changes conflicting with the target branch.
  • index.html

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u master:deadvey-master
git checkout deadvey-master
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: javalsai/website#2
No description provided.