Skip to content

Should data-color-scheme define background and color? #4478

@mimarz

Description

@mimarz

When using Designsystemet I ran into problems using data-color-scheme to always enforece dark/light mode on "surfaces" and other parts of the site.

When using data-color-scheme it would set background and color on the specific element the attribute is used on, this would mess up the design as we used other colors and backgrounds than what i predefined.

Yes, this can easily be remedied by setting inherit on the element, but this feels cumbersome as not everyone might know this, or have to make new classes just remedie this.

Our definition in base.css:

body,
[data-color-scheme] {
  color: var(--ds-color-neutral-text-default);
  background: var(--ds-color-neutral-background-default);
}

What is reason for the [data-color-scheme] selector to be there? Functionally we only want the data attr to flight between color-schemes, so if we don't need it I suggest we remove it.

This will be a breaking change, but looks to be a bug by default, so we need to figure out when and how to communicate this fix.

Metadata

Metadata

Assignees

Labels

css@digdir/designsystemet-css🐛 bugSomething isn't working

Type

No type

Projects

Status

👀 Ready for review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions