-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[experiment] Adaptive Illustrations for themes and color modes #206540
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
base: main
Are you sure you want to change the base?
[experiment] Adaptive Illustrations for themes and color modes #206540
Conversation
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
829e3b9
to
803ec26
Compare
CC @ryankeairns @elastic/eui-team |
<Removed this comment, Clint posted a link to the doc below> |
@JasonStoltz Yeah, I had to wait for CI to complete the Storybook build before I could post the link to the doc. |
I like this. It solves some problems:
Questions or challenges I see:
|
I did a quick RegEx find-and-replace with both of these SVGs. The toughest part was figuring out the color changes, rather than replacing
I think we can just tweak the source-- I assume there's an Adobe Illustrator file or similar somewhere-- but we could just as easily write a script to convert back and forth between We could always keep both formats: one as source SVG, one as Kibana web-adaptable SVG...? |
with regards to the point about manually replacing hardcoded values, ideally we could consider some util that transforms regular svgs to "kibana web adaptable svg". If we are able to make something of this sort, then the questions pertaining to making a regular SVG into our "adaptable SVG", alongside accommodating tweaks after it already exists as an adaptable SVG sort of goes away, really it's the heuristics for generating the customization points and having it be meaningful that would then be what we'd have to agree on. |
## Summary After a CI run, Storybooks are built. Each commit is built and uploaded separately, which makes sense: https://github.com/elastic/kibana/blob/main/.buildkite/scripts/steps/storybooks/build_and_upload.ts#L24 Unfortunately, we don't have a way to consistently point to main, or to a PR. ## PRs Using #206540 as an example, the Storybook is currently hosted at: https://ci-artifacts.kibana.dev/storybooks/pr-206540/803ec26fb200e1fd23c33ead174dcc5356262cfc This means that, if I push another commit, the URL will change... so all of the links I've posted in Slack are now invalid. This PR changes the URL so it will remain: https://ci-artifacts.kibana.dev/storybooks/pr-206540 regardless of how many commits I push. ## `main` Furthermore, being able to visit https://ci-artifacts.kibana.dev/storybooks/main/latest/index.html to see the most recent Storybook build is awesome. The issue is each Storybook is hosted with that same hash: https://ci-artifacts.kibana.dev/storybooks/main/5ad3ef7b0a76968a31b0824bd08f9132c374c841/shared_ux/index.html So this PR alters the URL so you can consistently point to the latest Storybook build: https://ci-artifacts.kibana.dev/storybooks/main/shared_ux/index.html
## Summary After a CI run, Storybooks are built. Each commit is built and uploaded separately, which makes sense: https://github.com/elastic/kibana/blob/main/.buildkite/scripts/steps/storybooks/build_and_upload.ts#L24 Unfortunately, we don't have a way to consistently point to main, or to a PR. ## PRs Using elastic#206540 as an example, the Storybook is currently hosted at: https://ci-artifacts.kibana.dev/storybooks/pr-206540/803ec26fb200e1fd23c33ead174dcc5356262cfc This means that, if I push another commit, the URL will change... so all of the links I've posted in Slack are now invalid. This PR changes the URL so it will remain: https://ci-artifacts.kibana.dev/storybooks/pr-206540 regardless of how many commits I push. ## `main` Furthermore, being able to visit https://ci-artifacts.kibana.dev/storybooks/main/latest/index.html to see the most recent Storybook build is awesome. The issue is each Storybook is hosted with that same hash: https://ci-artifacts.kibana.dev/storybooks/main/5ad3ef7b0a76968a31b0824bd08f9132c374c841/shared_ux/index.html So this PR alters the URL so you can consistently point to the latest Storybook build: https://ci-artifacts.kibana.dev/storybooks/main/shared_ux/index.html
/ci |
💔 Build Failed
Failed CI StepsHistory
cc @eokoneyo |
For any given illustration in Kibana, we maintain two discrete files: one for light mode, and one for dark mode. With the introduction of the Borealis theme, we would theoretically need to maintain four versions of each illustration.
By using CSS variables with appropriate fallbacks embedded in a single SVG, we can adapt the colors of the SVG to both the theme and color mode of Kibana. This will allow us to reduce the number of SVGs we need to maintain, and provide a more consistent UX between themes and color modes.
This is a proof-of-concept which uses a single SVG file and a JSON file of tokens and their color values. These are both read by a React component-- `Illustration`-- which compiles the color profile and adds the SVG to the DOM.
Demo and Docs
Storybook: Adaptive Illustrations
Documentation: Adaptive Illustrations writeup
To try the demo, you can view the Storybook built with this PR.
You can also check out this PR and run the Storybook locally: