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

feat: Adds vega-themes.json using vl_convert #3523

Merged
merged 12 commits into from
Aug 8, 2024
Merged
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* text=auto
* text=auto eol=lf
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
pip install pandas==0.25.3 numpy==1.17.5
- name: Test that schema generation has no effect
run: |
pip install vl-convert-python
python tools/generate_schema_wrapper.py
# This gets the paths of all files which were either deleted, modified
# or are not yet tracked by Git
Expand All @@ -60,6 +61,7 @@ jobs:
if [ ${#files_cleaned[@]} -gt 0 ]; then
echo "The code generation modified the following files:"
echo $files
git diff
exit 1
fi
- name: Test with pytest
Expand Down
4 changes: 2 additions & 2 deletions altair/utils/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

if TYPE_CHECKING:
from altair.utils.plugin_registry import PluginEnabler
from altair.vegalite.v5.theme import _ThemeName
from altair.vegalite.v5.theme import AltairThemes, VegaThemes

ThemeType = Callable[..., dict]


class ThemeRegistry(PluginRegistry[ThemeType, dict]):
def enable(
self, name: LiteralString | _ThemeName | None = None, **options
self, name: LiteralString | AltairThemes | VegaThemes | None = None, **options
) -> PluginEnabler:
"""
Enable a theme by name.
Expand Down
17 changes: 17 additions & 0 deletions altair/vegalite/v5/schema/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"TitleOrient_T",
"TypeForShape_T",
"Type_T",
"VegaThemes",
"WindowOnlyOp_T",
]

Expand All @@ -76,6 +77,22 @@ def func(
): ...
"""

VegaThemes: TypeAlias = Literal[
"carbong10",
"carbong100",
"carbong90",
"carbonwhite",
"dark",
"excel",
"fivethirtyeight",
"ggplot2",
"googlecharts",
"latimes",
"powerbi",
"quartz",
"urbaninstitute",
"vox",
]
Map: TypeAlias = Mapping[str, Any]
AggregateOp_T: TypeAlias = Literal[
"argmax",
Expand Down
Loading