Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Darker rule component #4801

Merged
merged 9 commits into from
Jun 23, 2023
Merged

Darker rule component #4801

merged 9 commits into from
Jun 23, 2023

Conversation

bartaz
Copy link
Member

@bartaz bartaz commented Jun 20, 2023

Done

  • darkens rule colours
  • adds dark example for rules
  • updates dark theme background colours

Fixes WD-4564
Fixes WD-4683
Fixes WD-4684

QA

Check if PR is ready for release

If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:

  • PR should have one of the following labels to automatically categorise it in release notes:
    • Feature 🎁, Breaking Change 💣, Bug 🐛, Documentation 📝, Maintenance 🔨.
  • Vanilla version in package.json should be updated relative to the most recent release, following semver convention:
    • if CSS class names are not changed it can be bugfix relesase (x.x.X)
    • if CSS class names are changed/added/removed it should be minor version (x.X.0)
    • see the wiki for more details
  • Any changes to component class names (new patterns, variants, removed or added features) should be listed on the what's new page.

@webteam-app
Copy link

Demo starting at https://vanilla-framework-4801.demos.haus

@lyubomir-popov
Copy link
Contributor

Looks good. Can we please add the following example - to indicate it is ok to use the black p-rule as a full-width element:
image

You can take it from my pr here (you'll need to uipdate the classes to what you've specified in the css):
https://canonical-com-898.demos.haus/

@ClementChaumel
Copy link
Contributor

The non-highlighted p-rule still uses opacity, I don't know if it's correct.

For the highlighted one, the contrast is insufficient for graphical elements components on a page https://webaim.org/resources/contrastchecker/?fcolor=000000&bcolor=222222#:~:text=Graphical%20Objects%20and%20User%20Interface%20Components

If the black text turns white on a dark background why not turn the p-rule white too?
image
image

@lyubomir-popov
Copy link
Contributor

For the highlighted one, the contrast is insufficient for graphical elements components on a page

That's for cases where they carry information, for example a chevron which is the only indication that something is interactive.
Rules are decorative elements so not subject to these requirements.

What we discussed with @bartaz yesterday was to add a theme-agnostic black hr.p-rule, for use in select cases.

We may still have a valid case for a white bar and a transparency one, this is why we're not modifying the hr.is-dark styling - that results in a white hr with opacity.

Just checked the example, I would expect the classes is-dark and p-rule--highlighted to be possible on the same element in the dark theme. Maybe we can add that @bartaz?

@bartaz
Copy link
Member Author

bartaz commented Jun 22, 2023

Dark theme colours:

background defaultr: #262626
background alt: 2d2d2d

default dark border is white 0.1 opacity
hi contast 0.5 opacity

highlight bars are text colour on both themes

@lyubomir-popov
Copy link
Contributor

lyubomir-popov commented Jun 22, 2023

@bartaz can we have a is-thick modifier so we can obtain the semi-transparent version in the thick style? It's the only way I can think of achieving this given the current setup:

image

Copy link
Contributor

@ClementChaumel ClementChaumel left a comment

Choose a reason for hiding this comment

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

Well done 🚀

Comment on lines 53 to 63
hr.is-light,
hr.on-light {
@include vf-hr-light-theme;
}
} @else {
hr {
@include vf-hr-light-theme;
}

hr.is-dark {
hr.is-dark,
hr.on-dark {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have both is and on modifiers?

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to deprecate is-dark as it's often confusing ("is-dark" rule or icons being white), so "on-dark" makes more sense - they are supposed to be used on dark backgrounds.

I forgot to add deprecation comments and docs.

Ideally later (hopefuly for 4.0 release) I want to revisit other is-theme class names and do similar change where relevant.

Copy link
Member Author

Choose a reason for hiding this comment

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

So on-dark is new and should be used is-dark is needed for backwards compatibility.

@lyubomir-popov
Copy link
Contributor

Thanks @bartaz I've given +1. Ideally the dark example should use a default 1px line for the left aligned headings, and a muted one for the ones inside, to match the latest design, but fine to go as is if you're pressed for time.
image

@bartaz
Copy link
Member Author

bartaz commented Jun 23, 2023

@lyubomir-popov You may have been looking at the older example, maybe demo was not updated yet, or cached.

It should look like this:
image

I deliberately used all versions (thick, default, muted) so we can see them all on dark theme:
https://vanilla-framework-4801.demos.haus/docs/examples/patterns/rule/dark

@lyubomir-popov
Copy link
Contributor

I deliberately used all versions (thick, default, muted) so we can see them all on dark theme:

Ah got it, good idea. Thanks for explaining.

@bartaz bartaz merged commit ad4fbdd into canonical:vanilla-4.0 Jun 23, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants