Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Michael Kohl 🇦🇹🇹🇭
@citizen428@chaos.social  ·  activity timestamp 2 weeks ago

I have to say, modern CSS is really quite good. This is all it takes for my — admittedly minimalist — blog to have light and dark mode and automatically calculated colors for visited links.

#css #webdev

A screenshot of the following CSS code in a text editor with the Nord color scheme:

:root {
  color-scheme: light dark;
  --text: light-dark(#444, #bbb);
  --link: light-dark(#0076d1, #e27a11);
}

body {
  color: var(--text);
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  text-decoration-color: oklch(from currentColor l c h / 50%);

  &:visited {
    color: oklch(from var(--link) calc(l - 0.3) c h);
  }
}

blockquote {
  background: light-dark(#f9f9f9, #1a1a1a);
  border-left: 10px solid light-dark(#ccc, #333);
}
A screenshot of the following CSS code in a text editor with the Nord color scheme: :root { color-scheme: light dark; --text: light-dark(#444, #bbb); --link: light-dark(#0076d1, #e27a11); } body { color: var(--text); } a { color: var(--link); text-underline-offset: 0.2em; text-decoration-thickness: 1px; text-decoration-color: oklch(from currentColor l c h / 50%); &:visited { color: oklch(from var(--link) calc(l - 0.3) c h); } } blockquote { background: light-dark(#f9f9f9, #1a1a1a); border-left: 10px solid light-dark(#ccc, #333); }
A screenshot of the following CSS code in a text editor with the Nord color scheme: :root { color-scheme: light dark; --text: light-dark(#444, #bbb); --link: light-dark(#0076d1, #e27a11); } body { color: var(--text); } a { color: var(--link); text-underline-offset: 0.2em; text-decoration-thickness: 1px; text-decoration-color: oklch(from currentColor l c h / 50%); &:visited { color: oklch(from var(--link) calc(l - 0.3) c h); } } blockquote { background: light-dark(#f9f9f9, #1a1a1a); border-left: 10px solid light-dark(#ccc, #333); }
  • Copy link
  • Flag this post
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.2.21 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login