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

[Playground] Color Swatches #1214

Merged
merged 15 commits into from
Oct 10, 2024
Merged

[Playground] Color Swatches #1214

merged 15 commits into from
Oct 10, 2024

Conversation

Copy link

netlify bot commented Oct 3, 2024

Deploy Preview for sass-lang ready!

Name Link
🔨 Latest commit c458076
🔍 Latest deploy log https://app.netlify.com/sites/sass-lang/deploys/6706e21058d0d3000828a6bd
😎 Deploy Preview https://deploy-preview-1214--sass-lang.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 465 to 483
display: inline-flex;

div {
background-color: var(--color);
height: var(--sl-size--swatch);
margin-inline-start: var(--sl-gutter--quarter);
outline: var(--sl-border--small) solid var(--sl-color--text-medium-dark);
outline-offset: calc(var(--sl-border--small) * -1);
width: var(--sl-size--swatch);
}

span {
font-family: var(--sl-font-family--emoji);
// Make slightly larger
font-size: var(--sl-font-size--small);
// Adjusted to accommodate larger font-size
line-height: 1.2;
margin-inline-start: var(--sl-gutter--quarter);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make the warning sign more of a decoration on the swatch rather than a full-size inline element:

image

Suggested change
display: inline-flex;
div {
background-color: var(--color);
height: var(--sl-size--swatch);
margin-inline-start: var(--sl-gutter--quarter);
outline: var(--sl-border--small) solid var(--sl-color--text-medium-dark);
outline-offset: calc(var(--sl-border--small) * -1);
width: var(--sl-size--swatch);
}
span {
font-family: var(--sl-font-family--emoji);
// Make slightly larger
font-size: var(--sl-font-size--small);
// Adjusted to accommodate larger font-size
line-height: 1.2;
margin-inline-start: var(--sl-gutter--quarter);
}
position: relative;
div {
background-color: var(--color);
height: var(--sl-size--swatch);
margin-inline-start: var(--sl-gutter--quarter);
outline: var(--sl-border--small) solid var(--sl-color--text-medium-dark);
outline-offset: calc(var(--sl-border--small) * -1);
width: var(--sl-size--swatch);
}
span {
font-family: var(--sl-font-family--emoji);
font-size: 0.5625rem;
position: absolute;
top: -0.3125rem;
right: -0.3125rem;
}

You could even replace the span with an ::after based on a class name, although I don't have a strong opinion about whether or not that's better.

source/assets/js/playground/console-utils.ts Outdated Show resolved Hide resolved
source/assets/js/playground/console-utils.ts Show resolved Hide resolved
@nex3
Copy link
Contributor

nex3 commented Oct 7, 2024

Looks really good!

@stacyk
Copy link
Contributor

stacyk commented Oct 8, 2024

@nex3 We added the overlapping warning and gave it a text-shadow while cleaning up a bit. We kept the span in order to have the tooltip when out of gamut. Here's a preview.

@nex3
Copy link
Contributor

nex3 commented Oct 9, 2024

Can we make the warning images a little smaller? Having them around the same size as the color box itself feels like it distracts from the color value itself and makes what should be a minor advisory feel like a larger problem.

@stacyk
Copy link
Contributor

stacyk commented Oct 9, 2024

@nex3 on Chrome the emoji itself wouldn't go smaller (with font-size) so I am using scale() now. This seems to be more consistent across different browsers now.

@nex3
Copy link
Contributor

nex3 commented Oct 10, 2024

Looks great, thanks!

@nex3 nex3 merged commit 707db7d into sass:main Oct 10, 2024
9 checks passed
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.

Display color swatches in Playground
3 participants