Skip to content

Conversation

@JackHowa
Copy link
Owner

@JackHowa JackHowa commented Dec 16, 2025

Goals

  • Use material design 3 inspiration
  • Have a color picker
  • Works in light and dark mode

Questions

  • Does the color picker really connote that the page is themable?

Todo

  • I don't like the material colors. I want to do something different ... have a couple of ideas
  • Check accessibility of theming and how to change theme
  • Possibly add emoji for the links
  • In light mode, moving the theme picker to the top left of all the way light makes the text unreadable
  • Could also do apple-esque liquid glass but for the office compostable office cups. Red cup would be funny as well
    cups
  • Want to try something themeable as well with plants and the border shape like a leaf for different plants and picking different photos
  • Update the favicon to the background color and foreground. Update to use first and last initial if I want to go for that

In progress

  • My new blooming orange marigold as inspiration. can find other plants around the apartment or in travels if this works. Updated the orange to more closely match this and made it so that this orange is the default
    IMG_8353

color-scheme: light dark;
--light-color: #ffcfb8;
--dark-color: #113134;
--md-primary: #ea6a00;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

material design variables originally set

sans-serif;
top: 20px;
right: 20px;
background: var(--md-surface-container-high);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surface container higher so it's more visible https://m3.material.io/blog/tone-based-surface-color-m3

</main>

<script>
function hexToRgb(hex) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

picks a hex but needs to convert to rgb in order to do math on it

const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
// Generate tonal palette (MD3 approach)
const lightness = hsl.l;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outlinedHover: `hsla(${hsl.h}, ${hsl.s}%, ${lightness + 40}%, 0.08)`,
// If primary lightness > 60%, uses dark text (same hue at 20% lightness)
// Otherwise uses white text
onPrimary: primaryL > 60 ? `hsl(${hsl.h}, ${hsl.s}%, 20%)` : '#ffffff'
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure that color is still visible

applyTheme(colorPicker.value);
// Re-apply theme when system color scheme changes
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure that theme is still updated

X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Content-Security-Policy = "default-src 'self'; style-src 'unsafe-inline';"
Content-Security-Policy = "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline';"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow scripts to run inline; may use a different framework so this is easier to do on the page

function generateColorScheme(baseColor) {
const rgb = hexToRgb(baseColor);
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably more complicated (but easier if you can include a library), but OKLCH is better for lightness manipulations than HSL: https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh this is helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants