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

[ui] Themes #18442

Merged
merged 23 commits into from
Dec 3, 2023
Merged

[ui] Themes #18442

merged 23 commits into from
Dec 3, 2023

Conversation

hellendag
Copy link
Member

Summary & Motivation

Introduce a system for theming the Dagster UI. All direct references to color values are replaced by a set of functions that match semantic color names to theme-based palette values.

The theme value is exposed via a User Setting.

Discussion here: #18439

How I Tested These Changes

TS, lint, jest. Find all existing references to LegacyColors, hex values, rgb/rgba values and replace them with color functions.

Navigate throughout the app in legacy, light, and dark modes. Verify that colors look appropriate.

hellendag and others added 23 commits December 1, 2023 12:19
## Summary & Motivation

Add a legacy theme to keep the colors mostly unchanged while working on
the new palettes.

## How I Tested These Changes
## Summary & Motivation
Adds a bunch of small style tweaks to the dark and light themes 

## How I Tested These Changes
Booted up the UI and tried it
[INTERNAL_BRANCH=dish/cloud-palettes]
## Summary & Motivation
More theme style tweaks

## How I Tested These Changes
Booted up the UI

---------

Co-authored-by: Isaac Hellendag <[email protected]>
Co-authored-by: Isaac Hellendag <[email protected]>
Copy link

github-actions bot commented Dec 1, 2023

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-8gv6y3rie-elementl.vercel.app
https://dish-palettes.components-storybook.dagster-docs.io

Built with commit fd59242.
This pull request is being automatically deployed with vercel-action

Copy link

github-actions bot commented Dec 1, 2023

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-3h4x9d4bj-elementl.vercel.app
https://dish-palettes.core-storybook.dagster-docs.io

Built with commit fd59242.
This pull request is being automatically deployed with vercel-action

Copy link
Collaborator

@bengotow bengotow left a comment

Choose a reason for hiding this comment

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

This looks awesome. The approach seems solid and I'm a big fan of the semantic naming of the color values. Props for going through and re-classifying everything, this must have taken a while! 💯

@@ -101,7 +103,7 @@ const Form = ({dismiss, submit}: FormProps) => {
>
<Box flex={{direction: 'column', gap: 8, alignItems: 'start', justifyContent: 'start'}}>
<Heading>Join the Dagster community</Heading>
<Body style={{color: Colors.Gray700, marginBottom: '4px'}}>
Copy link
Collaborator

@bengotow bengotow Dec 2, 2023

Choose a reason for hiding this comment

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

Unrelated, but was moving to base exports from ui-components explicit? I guess this could have stayed Colors.textLight(), curious if that'd be better / worse (though arguably not better enough to be worth changing now!)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I guess we could have the functions namespaced under Colors. If you guys feel strongly about doing that instead, we could do a find/replace for it.

style={{width: '100%'}}
/>
{emailChanged && blurred && !validEmail ? (
<div style={{paddingBottom: '12px', color: Colors.Red500, fontSize: '12px'}}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Noticed that this "Red500" and the above "Red500" were changed differently based on the context of use which is awesome but... must have taken a while. Thanks for doing all this!

@@ -35,31 +45,34 @@ const StarIcon = ({checked, indeterminate, fillColor, disabled}: IconProps) => (
<path
className="interaction-focus-outline"
d="M8.99983 14.27L13.1498 16.78C13.9098 17.24 14.8398 16.56 14.6398 15.7L13.5398 10.98L17.2098 7.80001C17.8798 7.22001 17.5198 6.12001 16.6398 6.05001L11.8098 5.64001L9.91983 1.18001C9.57983 0.37001 8.41983 0.37001 8.07983 1.18001L6.18983 5.63001L1.35983 6.04001C0.479829 6.11001 0.119828 7.21001 0.789828 7.79001L4.45983 10.97L3.35983 15.69C3.15983 16.55 4.08983 17.23 4.84983 16.77L8.99983 14.27Z"
fill={Colors.White}
fill={disabled ? colorBackgroundGray() : colorBackgroundDefault()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I really like the strategy you've taken here (color functions) as opposed to using styled-components Theme support or @media(prefer-color-scheme: dark). I've seen other apps that try to sync to the system theme via CSS, but then /every single color reference/ needs to be in CSS (or tied to fancy media-watching JS) because the value can change without a page reload.

I like that this solution still lets us interpolate the color at render time and slap it wherever we need to. Slight bummer that at 5:00pm it won't auto-shift to dark mode without a page reload, but the engineering cost for that one page load is HIGH and not worth it.

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 don't think I've seen the 5pm shift before! I'm just always in dark mode. We could come back to this if it seems important to users.

[ColorName.DataVizVioletAlt]: DataVizColors.Violet300,
[ColorName.DataVizYellow]: DataVizColors.Yellow200,
[ColorName.DataVizYellowAlt]: DataVizColors.Yellow300,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the DataViz family names :)

Comment on lines +125 to +126
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated but seems fine!

position: relative;
transition: all 150ms linear;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ooh does this animate the border change on click?

box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 12px 0px;
scale: 1.03;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one is a bit interesting (and new i think?), might be worth a comment about what this does

Copy link
Contributor

Choose a reason for hiding this comment

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

I did added this one. It adds a slight scale effect on hover. We have the same effect on the new group nodes as well. happy to revisit this if y'all find it distracting but the primary motivation for adding it was that we previously relied on a box shadow for the node hover style, and this doesn't show up well in dark mode. The scale transition works well in both light and dark mode

@hellendag hellendag merged commit e5bfb14 into master Dec 3, 2023
2 checks passed
@hellendag hellendag deleted the dish/palettes branch December 3, 2023 16:10
@hellendag hellendag mentioned this pull request Dec 4, 2023
zyd14 pushed a commit to zyd14/dagster that referenced this pull request Jan 20, 2024
## Summary & Motivation

Introduce a system for theming the Dagster UI. All direct references to
color values are replaced by a set of functions that match semantic
color names to theme-based palette values.

The theme value is exposed via a User Setting.

Discussion here: dagster-io#18439

## How I Tested These Changes

TS, lint, jest. Find all existing references to `LegacyColors`, hex
values, rgb/rgba values and replace them with color functions.

Navigate throughout the app in legacy, light, and dark modes. Verify
that colors look appropriate.

---------

Co-authored-by: Josh Braun <[email protected]>
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.

3 participants