c0d3-app icon indicating copy to clipboard operation
c0d3-app copied to clipboard

Dark mode support

Open songz opened this issue 3 years ago • 8 comments

Screen Shot 2022-02-28 at 4 53 11 PM

songz avatar Mar 01 '22 00:03 songz

Dark mode for C0d3 is good.

evo777 avatar Mar 01 '22 03:03 evo777

dark mode will be a good feature to implement , if i will get time from exams , i will try for sure :shipit:

shockz09 avatar Mar 01 '22 05:03 shockz09

off-topic: shipit invaded GitHub @mino323

flacial avatar Mar 01 '22 11:03 flacial

What do you think about migrating from Bootstrap to https://tailwindcss.com/?

flacial avatar Mar 06 '22 06:03 flacial

@flacial

tailwind css will be much better in my opinion

shockz09 avatar Mar 06 '22 06:03 shockz09

Tailwind CSS is good.

evo777 avatar Mar 06 '22 08:03 evo777

I added darkmode support to my note taking site, this is what I did: https://github.com/songz/noteapp/pull/30/files

songz avatar Jun 19 '22 09:06 songz

I think there's an easy way to achieve dark mode, if we have css color variables for light and dark mode, depending on what the client prefers, we can switch between light mode and dark mode using a toggle button by changing the data-theme attribute. Something like this:

html[data-theme="dark"] {
  --color-bg: #000000;
}

html[data-theme="light"] {
  --color-bg: #ffffff;
}

.element {
  background-color: var(--color-bg);
}
function switchTheme(e) {
  if (e.target.checked) {
    document.documentElement.setAttribute("data-theme", "dark");
  } else {
    document.documentElement.setAttribute("data-theme", "light");
  }
}

This way, all we have to do is write new color variables and update our elements to use those colors to make the toggle switch work.

SlyBouhafs avatar Jun 19 '22 09:06 SlyBouhafs