Skip to content

feat: add user colors to Lumo and Material styles - #3025

Merged
web-padawan merged 7 commits into
masterfrom
feat/user-colors
Nov 15, 2021
Merged

web-padawan merged 7 commits into
masterfrom
feat/user-colors

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Description

  1. Copied the corresponding styles modules from the CE repo, updated to not use <custom-style>,
  2. Updated avatar package to import the newly added style modules in Lumo and Material themes,
  3. Changed WTR setup to no longer provide hardcoded user colors (the avatar now imports them),
  4. Updated Material screenshots to match the new colors (previously Lumo colors were used there).

Fixes #1604

Type of change

  • Feature

Checklist

  • Yes 😄


const userColors = css`
:host {
--vaadin-user-color-0: #df0b92;

@web-padawan web-padawan Nov 11, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

See the original Lumo styles here.


const userColors = css`
:host {
--vaadin-user-color-0: #ab47bc;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

See the original Material styles here.

@tomivirkki

Copy link
Copy Markdown
Member

Looks good overall. Just to confirm, do we still want to call them "user colors" in this context if they're not specifically related to "users" (but available for any use case)?

@web-padawan

Copy link
Copy Markdown
Member Author

That's a good point. Ideally we would can keep the current API as is, but now is the right moment to change it.
@jouni WDYT about this? Do we keep using --vaadin-user-color-0 etc, or should we pick another name?

@jouni

jouni commented Nov 11, 2021

Copy link
Copy Markdown
Member

I did have similar thoughts when I looked at this PR. Ideally, I think, we should offer a fuller palette of color scales (think of Tailwind/Radix/etc, with blue/red/green/teal/purple/indigo/etc from 50–900/1–12), which could then be applied for this use case.

But I also feel like it might still make sense to have this semantic layer of custom properties for this use case (similar to, for example, --lumo-text-field-background). I suppose “user” is the correct semantic concept in this case?

What other potential use cases did Tomi have in mind for these colors?

I admit I don't have clear enough thoughts about this at the moment.

@web-padawan

Copy link
Copy Markdown
Member Author

For now the colors are used by field highlighter and vaadin-avatar (also vaadin-message but that's something we might want to change as requested by #1599). IMO we need some common color name for both.

@tomivirkki

Copy link
Copy Markdown
Member

What other potential use cases did Tomi have in mind for these colors?

Was mainly referencing this #1604 (comment)

@web-padawan

web-padawan commented Nov 13, 2021 •

Copy link
Copy Markdown
Member Author

I suppose “user” is the correct semantic concept in this case?

We could have more generic names e.g. --lumo-entity-color-0 but IMO the old names need to be preserved too.

UPD: we do have userColorIndex as part of public API in both vaadin-message and vaadin-message-list:

userColorIndex: {
type: Number
}

@jouni jouni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can keep the existing property names. We can re-evaluate that in the future if needed.

@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
2.5% 2.5% Duplication

@web-padawan
web-padawan merged commit 05f37a2 into master Nov 15, 2021
@web-padawan
web-padawan deleted the feat/user-colors branch November 15, 2021 11:30
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with platform 23.0.0.

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.

Move user colors from Collaboration Engine to Lumo & Material

4 participants