Skip to content

Conversation

@abolix
Copy link

@abolix abolix commented Sep 4, 2025

This fixes an issue where explicitly configured color mode preferences (like preference: 'light') would be overridden by previously stored values from localStorage/cookies.

When a user sets preference to a specific mode (not 'system'), it should take precedence over any stored preferences from previous sessions.

Fixes: Color mode preference not respected when switching between projects

🔗 Linked issue

Fixes #318

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

This fixes an issue where explicitly configured color mode preferences
(like preference: 'light') would be overridden by previously stored
values from localStorage/cookies.

When a user sets preference to a specific mode (not 'system'), it should
take precedence over any stored preferences from previous sessions.

Fixes: Color mode preference not respected when switching between projects
@netlify
Copy link

netlify bot commented Sep 4, 2025

👷 Deploy Preview for nuxt-color-mode processing.

Name Link
🔨 Latest commit bbfadef
🔍 Latest deploy log https://app.netlify.com/projects/nuxt-color-mode/deploys/68b957c19f68c70007611b3a

@netlify
Copy link

netlify bot commented Sep 4, 2025

Deploy Preview for nuxt-color-mode canceled.

Name Link
🔨 Latest commit dc1002d
🔍 Latest deploy log https://app.netlify.com/projects/nuxt-color-mode/deploys/68c1335d958d5500086fc276

- Remove trailing spaces on empty lines to fix linting error
- Fixes @stylistic/no-trailing-spaces eslint rule
Copy link
Collaborator

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

this doesn't seem correct to me.

options.preference here is not set by the user but by you, and therefore it should never override the user's choice.

it is the 'default' preference

* The default value of $colorMode.preference

there's a different way to force a color mode if you need to

@abolix
Copy link
Author

abolix commented Nov 11, 2025

Well it's not exactly the problem, can you please look at the issue #318 so I don't have to explain all over again ?

it's mainly about running 2 project in different times at the same port when one project is forced on dark and one is forced on light, it does not switch automatically and we have to clear localstorage

@danielroe
Copy link
Collaborator

i read it but i'm have you understood my comment?

this change breaks the functionality of this module in production by changing a 'default' to an override

@abolix
Copy link
Author

abolix commented Nov 21, 2025

understood but is there any other way that without breaking the functionality we can implement this ?

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.

forced dark and light mode in 2 different projects

2 participants