-
Notifications
You must be signed in to change notification settings - Fork 794
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
feat: Adds vega-themes.json
using vl_convert
#3523
Conversation
Not sure of the right command here, as I can't repro locally
@jonmmease Seem to have resolved in I don't quite understand how my |
@jonmmease we could keep this PR atomic and just merge as-is. I did some playing around with What do you think? |
Yeah, it's not a very large file, so I think it's fine to merge without being used. And I think someone could technically load the json file directly using Let's leave it open another day to see if there are any other opinions. Feel free to ping me in 24 hrs if we haven't heard anything and I'll merge it. |
Sounds good to me @jonmmease
This was the shortest I came up with: diff --git a/altair/vegalite/v5/theme.py b/altair/vegalite/v5/theme.py
index a3c62165..097e7b30 100644
--- a/altair/vegalite/v5/theme.py
+++ b/altair/vegalite/v5/theme.py
@@ -53,6 +53,15 @@ VEGA_THEMES = [
]
+def _load_themes():
+ import json
+ from pathlib import Path
+
+ from altair.vegalite.v5 import schema
+
+ return json.loads((Path(*schema.__path__) / "vega-themes.json").read_text())
+
+
class VegaTheme:
"""Implementation of a builtin vega theme."""
I'd prefer leaving it out for now, since there is quite a lot of variation between the themes. |
Likely the source of vega#3523 (comment)
* ci: Bump `vl-convert-python>=1.6.0` Likely the source of #3523 (comment) * ci: Bump `sphinx>=8.0.0` Possibly resolves issue #3515 (comment)
Sorry I wasn't very clear there. I wasn't suggesting we provide a function to do this. Just pointing our that an end-user could do this if they needed to for some reason. |
Resolves the *long-term* solution mentioned in vega#3519 (comment)
"vox", | ||
] | ||
AltairThemes: TypeAlias = Literal["default", "opaque"] | ||
VEGA_THEMES: list[str] = list(get_args(VegaThemes)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @binste this combines both of our comments #3516 (comment)
@jonmmease if you're available to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT! Agree that with 24kb it's small enough to include directly. Merging as Jon has indicated that he's ok with it as well.
#3519 (comment)
Provides inline definitions from
vega-themes
.Thought this made more sense as
.json
, rather than adict
within a module.Eventually these could each be read into a Theme/Config
TypedDict
as mentioned in #3519