From 5c19787e895fa570266e3a672ab9be7d9cbb0c89 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 5 Aug 2024 21:47:00 +0100 Subject: [PATCH 01/10] feat: Adds `vega-themes.json` using `vl_convert` https://github.com/vega/altair/issues/3519#issuecomment-2267875356 --- altair/vegalite/v5/schema/vega-themes.json | 1261 ++++++++++++++++++++ tools/generate_schema_wrapper.py | 9 + 2 files changed, 1270 insertions(+) create mode 100644 altair/vegalite/v5/schema/vega-themes.json diff --git a/altair/vegalite/v5/schema/vega-themes.json b/altair/vegalite/v5/schema/vega-themes.json new file mode 100644 index 000000000..ca679cd59 --- /dev/null +++ b/altair/vegalite/v5/schema/vega-themes.json @@ -0,0 +1,1261 @@ +{ + "carbong10": { + "background": "#f4f4f4", + "arc": { + "fill": "#6929c4" + }, + "area": { + "fill": "#6929c4" + }, + "path": { + "stroke": "#6929c4" + }, + "rect": { + "fill": "#6929c4" + }, + "shape": { + "stroke": "#6929c4" + }, + "symbol": { + "stroke": "#6929c4" + }, + "circle": { + "fill": "#6929c4" + }, + "view": { + "fill": "#ffffff", + "stroke": "#ffffff" + }, + "group": { + "fill": "#ffffff" + }, + "title": { + "color": "#161616", + "anchor": "start", + "dy": -15, + "fontSize": 16, + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 600 + }, + "axis": { + "labelColor": "#161616", + "labelFontSize": 12, + "grid": true, + "gridColor": "#525252", + "titleColor": "#161616", + "labelAngle": 0 + }, + "style": { + "guide-label": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#161616", + "fontWeight": 400 + }, + "guide-title": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#161616", + "fontWeight": 400 + } + }, + "range": { + "category": [ + "#6929c4", + "#1192e8", + "#005d5d", + "#9f1853", + "#fa4d56", + "#570408", + "#198038", + "#002d9c", + "#ee538b", + "#b28600", + "#009d9a", + "#012749", + "#8a3800", + "#a56eff" + ], + "diverging": [ + "#750e13", + "#a2191f", + "#da1e28", + "#fa4d56", + "#ff8389", + "#ffb3b8", + "#ffd7d9", + "#fff1f1", + "#e5f6ff", + "#bae6ff", + "#82cfff", + "#33b1ff", + "#1192e8", + "#0072c3", + "#00539a", + "#003a6d" + ], + "heatmap": [ + "#f6f2ff", + "#e8daff", + "#d4bbff", + "#be95ff", + "#a56eff", + "#8a3ffc", + "#6929c4", + "#491d8b", + "#31135e", + "#1c0f30" + ] + } + }, + "carbong100": { + "background": "#161616", + "arc": { + "fill": "#d4bbff" + }, + "area": { + "fill": "#d4bbff" + }, + "path": { + "stroke": "#d4bbff" + }, + "rect": { + "fill": "#d4bbff" + }, + "shape": { + "stroke": "#d4bbff" + }, + "symbol": { + "stroke": "#d4bbff" + }, + "circle": { + "fill": "#d4bbff" + }, + "view": { + "fill": "#161616", + "stroke": "#161616" + }, + "group": { + "fill": "#161616" + }, + "title": { + "color": "#f4f4f4", + "anchor": "start", + "dy": -15, + "fontSize": 16, + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 600 + }, + "axis": { + "labelColor": "#f4f4f4", + "labelFontSize": 12, + "grid": true, + "gridColor": "#525252", + "titleColor": "#f4f4f4", + "labelAngle": 0 + }, + "style": { + "guide-label": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#f4f4f4", + "fontWeight": 400 + }, + "guide-title": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#f4f4f4", + "fontWeight": 400 + } + }, + "range": { + "category": [ + "#8a3ffc", + "#33b1ff", + "#007d79", + "#ff7eb6", + "#fa4d56", + "#fff1f1", + "#6fdc8c", + "#4589ff", + "#d12771", + "#d2a106", + "#08bdba", + "#bae6ff", + "#ba4e00", + "#d4bbff" + ], + "diverging": [ + "#750e13", + "#a2191f", + "#da1e28", + "#fa4d56", + "#ff8389", + "#ffb3b8", + "#ffd7d9", + "#fff1f1", + "#e5f6ff", + "#bae6ff", + "#82cfff", + "#33b1ff", + "#1192e8", + "#0072c3", + "#00539a", + "#003a6d" + ], + "heatmap": [ + "#f6f2ff", + "#e8daff", + "#d4bbff", + "#be95ff", + "#a56eff", + "#8a3ffc", + "#6929c4", + "#491d8b", + "#31135e", + "#1c0f30" + ] + } + }, + "carbong90": { + "background": "#262626", + "arc": { + "fill": "#d4bbff" + }, + "area": { + "fill": "#d4bbff" + }, + "path": { + "stroke": "#d4bbff" + }, + "rect": { + "fill": "#d4bbff" + }, + "shape": { + "stroke": "#d4bbff" + }, + "symbol": { + "stroke": "#d4bbff" + }, + "circle": { + "fill": "#d4bbff" + }, + "view": { + "fill": "#161616", + "stroke": "#161616" + }, + "group": { + "fill": "#161616" + }, + "title": { + "color": "#f4f4f4", + "anchor": "start", + "dy": -15, + "fontSize": 16, + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 600 + }, + "axis": { + "labelColor": "#f4f4f4", + "labelFontSize": 12, + "grid": true, + "gridColor": "#525252", + "titleColor": "#f4f4f4", + "labelAngle": 0 + }, + "style": { + "guide-label": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#f4f4f4", + "fontWeight": 400 + }, + "guide-title": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#f4f4f4", + "fontWeight": 400 + } + }, + "range": { + "category": [ + "#8a3ffc", + "#33b1ff", + "#007d79", + "#ff7eb6", + "#fa4d56", + "#fff1f1", + "#6fdc8c", + "#4589ff", + "#d12771", + "#d2a106", + "#08bdba", + "#bae6ff", + "#ba4e00", + "#d4bbff" + ], + "diverging": [ + "#750e13", + "#a2191f", + "#da1e28", + "#fa4d56", + "#ff8389", + "#ffb3b8", + "#ffd7d9", + "#fff1f1", + "#e5f6ff", + "#bae6ff", + "#82cfff", + "#33b1ff", + "#1192e8", + "#0072c3", + "#00539a", + "#003a6d" + ], + "heatmap": [ + "#f6f2ff", + "#e8daff", + "#d4bbff", + "#be95ff", + "#a56eff", + "#8a3ffc", + "#6929c4", + "#491d8b", + "#31135e", + "#1c0f30" + ] + } + }, + "carbonwhite": { + "background": "#ffffff", + "arc": { + "fill": "#6929c4" + }, + "area": { + "fill": "#6929c4" + }, + "path": { + "stroke": "#6929c4" + }, + "rect": { + "fill": "#6929c4" + }, + "shape": { + "stroke": "#6929c4" + }, + "symbol": { + "stroke": "#6929c4" + }, + "circle": { + "fill": "#6929c4" + }, + "view": { + "fill": "#ffffff", + "stroke": "#ffffff" + }, + "group": { + "fill": "#ffffff" + }, + "title": { + "color": "#161616", + "anchor": "start", + "dy": -15, + "fontSize": 16, + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 600 + }, + "axis": { + "labelColor": "#161616", + "labelFontSize": 12, + "grid": true, + "gridColor": "#525252", + "titleColor": "#161616", + "labelAngle": 0 + }, + "style": { + "guide-label": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#161616", + "fontWeight": 400 + }, + "guide-title": { + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fill": "#161616", + "fontWeight": 400 + } + }, + "range": { + "category": [ + "#6929c4", + "#1192e8", + "#005d5d", + "#9f1853", + "#fa4d56", + "#570408", + "#198038", + "#002d9c", + "#ee538b", + "#b28600", + "#009d9a", + "#012749", + "#8a3800", + "#a56eff" + ], + "diverging": [ + "#750e13", + "#a2191f", + "#da1e28", + "#fa4d56", + "#ff8389", + "#ffb3b8", + "#ffd7d9", + "#fff1f1", + "#e5f6ff", + "#bae6ff", + "#82cfff", + "#33b1ff", + "#1192e8", + "#0072c3", + "#00539a", + "#003a6d" + ], + "heatmap": [ + "#f6f2ff", + "#e8daff", + "#d4bbff", + "#be95ff", + "#a56eff", + "#8a3ffc", + "#6929c4", + "#491d8b", + "#31135e", + "#1c0f30" + ] + } + }, + "dark": { + "background": "#333", + "view": { + "stroke": "#888" + }, + "title": { + "color": "#fff", + "subtitleColor": "#fff" + }, + "style": { + "guide-label": { + "fill": "#fff" + }, + "guide-title": { + "fill": "#fff" + } + }, + "axis": { + "domainColor": "#fff", + "gridColor": "#888", + "tickColor": "#fff" + } + }, + "excel": { + "background": "#fff", + "arc": { + "fill": "#4572a7" + }, + "area": { + "fill": "#4572a7" + }, + "line": { + "stroke": "#4572a7", + "strokeWidth": 2 + }, + "path": { + "stroke": "#4572a7" + }, + "rect": { + "fill": "#4572a7" + }, + "shape": { + "stroke": "#4572a7" + }, + "symbol": { + "fill": "#4572a7", + "strokeWidth": 1.5, + "size": 50 + }, + "axis": { + "bandPosition": 0.5, + "grid": true, + "gridColor": "#000000", + "gridOpacity": 1, + "gridWidth": 0.5, + "labelPadding": 10, + "tickSize": 5, + "tickWidth": 0.5 + }, + "axisBand": { + "grid": false, + "tickExtra": true + }, + "legend": { + "labelBaseline": "middle", + "labelFontSize": 11, + "symbolSize": 50, + "symbolType": "square" + }, + "range": { + "category": [ + "#4572a7", + "#aa4643", + "#8aa453", + "#71598e", + "#4598ae", + "#d98445", + "#94aace", + "#d09393", + "#b9cc98", + "#a99cbc" + ] + } + }, + "fivethirtyeight": { + "arc": { + "fill": "#30a2da" + }, + "area": { + "fill": "#30a2da" + }, + "axis": { + "domainColor": "#cbcbcb", + "grid": true, + "gridColor": "#cbcbcb", + "gridWidth": 1, + "labelColor": "#999", + "labelFontSize": 10, + "titleColor": "#333", + "tickColor": "#cbcbcb", + "tickSize": 10, + "titleFontSize": 14, + "titlePadding": 10, + "labelPadding": 4 + }, + "axisBand": { + "grid": false + }, + "background": "#f0f0f0", + "group": { + "fill": "#f0f0f0" + }, + "legend": { + "labelColor": "#333", + "labelFontSize": 11, + "padding": 1, + "symbolSize": 30, + "symbolType": "square", + "titleColor": "#333", + "titleFontSize": 14, + "titlePadding": 10 + }, + "line": { + "stroke": "#30a2da", + "strokeWidth": 2 + }, + "path": { + "stroke": "#30a2da", + "strokeWidth": 0.5 + }, + "rect": { + "fill": "#30a2da" + }, + "range": { + "category": [ + "#30a2da", + "#fc4f30", + "#e5ae38", + "#6d904f", + "#8b8b8b", + "#b96db8", + "#ff9e27", + "#56cc60", + "#52d2ca", + "#52689e", + "#545454", + "#9fe4f8" + ], + "diverging": [ + "#cc0020", + "#e77866", + "#f6e7e1", + "#d6e8ed", + "#91bfd9", + "#1d78b5" + ], + "heatmap": [ + "#d6e8ed", + "#cee0e5", + "#91bfd9", + "#549cc6", + "#1d78b5" + ] + }, + "point": { + "filled": true, + "shape": "circle" + }, + "shape": { + "stroke": "#30a2da" + }, + "bar": { + "binSpacing": 2, + "fill": "#30a2da", + "stroke": null + }, + "title": { + "anchor": "start", + "fontSize": 24, + "fontWeight": 600, + "offset": 20 + } + }, + "ggplot2": { + "group": { + "fill": "#e5e5e5" + }, + "arc": { + "fill": "#000" + }, + "area": { + "fill": "#000" + }, + "line": { + "stroke": "#000" + }, + "path": { + "stroke": "#000" + }, + "rect": { + "fill": "#000" + }, + "shape": { + "stroke": "#000" + }, + "symbol": { + "fill": "#000", + "size": 40 + }, + "axis": { + "domain": false, + "grid": true, + "gridColor": "#FFFFFF", + "gridOpacity": 1, + "labelColor": "#7F7F7F", + "labelPadding": 4, + "tickColor": "#7F7F7F", + "tickSize": 5.67, + "titleFontSize": 16, + "titleFontWeight": "normal" + }, + "legend": { + "labelBaseline": "middle", + "labelFontSize": 11, + "symbolSize": 40 + }, + "range": { + "category": [ + "#000000", + "#7F7F7F", + "#1A1A1A", + "#999999", + "#333333", + "#B0B0B0", + "#4D4D4D", + "#C9C9C9", + "#666666", + "#DCDCDC" + ] + } + }, + "googlecharts": { + "arc": { + "fill": "#3366CC" + }, + "area": { + "fill": "#3366CC" + }, + "path": { + "stroke": "#3366CC" + }, + "rect": { + "fill": "#3366CC" + }, + "shape": { + "stroke": "#3366CC" + }, + "symbol": { + "stroke": "#3366CC" + }, + "circle": { + "fill": "#3366CC" + }, + "background": "#fff", + "padding": { + "top": 10, + "right": 10, + "bottom": 10, + "left": 10 + }, + "style": { + "guide-label": { + "font": "Arial, sans-serif", + "fontSize": 12 + }, + "guide-title": { + "font": "Arial, sans-serif", + "fontSize": 12 + }, + "group-title": { + "font": "Arial, sans-serif", + "fontSize": 12 + } + }, + "title": { + "font": "Arial, sans-serif", + "fontSize": 14, + "fontWeight": "bold", + "dy": -3, + "anchor": "start" + }, + "axis": { + "gridColor": "#ccc", + "tickColor": "#ccc", + "domain": false, + "grid": true + }, + "range": { + "category": [ + "#4285F4", + "#DB4437", + "#F4B400", + "#0F9D58", + "#AB47BC", + "#00ACC1", + "#FF7043", + "#9E9D24", + "#5C6BC0", + "#F06292", + "#00796B", + "#C2185B" + ], + "heatmap": [ + "#c6dafc", + "#5e97f6", + "#2a56c6" + ] + } + }, + "latimes": { + "background": "#ffffff", + "title": { + "anchor": "start", + "color": "#000000", + "font": "Benton Gothic Bold, sans-serif", + "fontSize": 22, + "fontWeight": "normal" + }, + "arc": { + "fill": "#82c6df" + }, + "area": { + "fill": "#82c6df" + }, + "line": { + "stroke": "#82c6df", + "strokeWidth": 2 + }, + "path": { + "stroke": "#82c6df" + }, + "rect": { + "fill": "#82c6df" + }, + "shape": { + "stroke": "#82c6df" + }, + "symbol": { + "fill": "#82c6df", + "size": 30 + }, + "axis": { + "labelFont": "Benton Gothic, sans-serif", + "labelFontSize": 11.5, + "labelFontWeight": "normal", + "titleFont": "Benton Gothic Bold, sans-serif", + "titleFontSize": 13, + "titleFontWeight": "normal" + }, + "axisX": { + "labelAngle": 0, + "labelPadding": 4, + "tickSize": 3 + }, + "axisY": { + "labelBaseline": "middle", + "maxExtent": 45, + "minExtent": 45, + "tickSize": 2, + "titleAlign": "left", + "titleAngle": 0, + "titleX": -45, + "titleY": -11 + }, + "legend": { + "labelFont": "Benton Gothic, sans-serif", + "labelFontSize": 11.5, + "symbolType": "square", + "titleFont": "Benton Gothic Bold, sans-serif", + "titleFontSize": 13, + "titleFontWeight": "normal" + }, + "range": { + "category": [ + "#ec8431", + "#829eb1", + "#c89d29", + "#3580b1", + "#adc839", + "#ab7fb4" + ], + "diverging": [ + "#e68a4f", + "#f4bb6a", + "#f9e39c", + "#dadfe2", + "#a6b7c6", + "#849eae" + ], + "heatmap": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232" + ], + "ordinal": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232" + ], + "ramp": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232" + ] + } + }, + "powerbi": { + "view": { + "stroke": "transparent" + }, + "background": "transparent", + "font": "Segoe UI", + "header": { + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "titleFontSize": 16, + "titleColor": "#252423", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "labelColor": "#605E5C" + }, + "axis": { + "ticks": false, + "grid": false, + "domain": false, + "labelColor": "#605E5C", + "labelFontSize": 12, + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "titleColor": "#252423", + "titleFontSize": 16, + "titleFontWeight": "normal" + }, + "axisQuantitative": { + "tickCount": 3, + "grid": true, + "gridColor": "#C8C6C4", + "gridDash": [ + 1, + 5 + ], + "labelFlush": false + }, + "axisBand": { + "tickExtra": true + }, + "axisX": { + "labelPadding": 5 + }, + "axisY": { + "labelPadding": 10 + }, + "bar": { + "fill": "#118DFF" + }, + "line": { + "stroke": "#118DFF", + "strokeWidth": 3, + "strokeCap": "round", + "strokeJoin": "round" + }, + "text": { + "font": "Segoe UI", + "fontSize": 12, + "fill": "#605E5C" + }, + "arc": { + "fill": "#118DFF" + }, + "area": { + "fill": "#118DFF", + "line": true, + "opacity": 0.6 + }, + "path": { + "stroke": "#118DFF" + }, + "rect": { + "fill": "#118DFF" + }, + "point": { + "fill": "#118DFF", + "filled": true, + "size": 75 + }, + "shape": { + "stroke": "#118DFF" + }, + "symbol": { + "fill": "#118DFF", + "strokeWidth": 1.5, + "size": 50 + }, + "legend": { + "titleFont": "Segoe UI", + "titleFontWeight": "bold", + "titleColor": "#605E5C", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "labelColor": "#605E5C", + "symbolType": "circle", + "symbolSize": 75 + }, + "range": { + "category": [ + "#118DFF", + "#12239E", + "#E66C37", + "#6B007B", + "#E044A7", + "#744EC2", + "#D9B300", + "#D64550" + ], + "diverging": [ + "#DEEFFF", + "#118DFF" + ], + "heatmap": [ + "#DEEFFF", + "#118DFF" + ], + "ordinal": [ + "#DEEFFF", + "#c7e4ff", + "#b0d9ff", + "#9aceff", + "#83c3ff", + "#6cb9ff", + "#55aeff", + "#3fa3ff", + "#2898ff", + "#118DFF" + ] + } + }, + "quartz": { + "background": "#f9f9f9", + "arc": { + "fill": "#ab5787" + }, + "area": { + "fill": "#ab5787" + }, + "line": { + "stroke": "#ab5787" + }, + "path": { + "stroke": "#ab5787" + }, + "rect": { + "fill": "#ab5787" + }, + "shape": { + "stroke": "#ab5787" + }, + "symbol": { + "fill": "#ab5787", + "size": 30 + }, + "axis": { + "domainColor": "#979797", + "domainWidth": 0.5, + "gridWidth": 0.2, + "labelColor": "#979797", + "tickColor": "#979797", + "tickWidth": 0.2, + "titleColor": "#979797" + }, + "axisBand": { + "grid": false + }, + "axisX": { + "grid": true, + "tickSize": 10 + }, + "axisY": { + "domain": false, + "grid": true, + "tickSize": 0 + }, + "legend": { + "labelFontSize": 11, + "padding": 1, + "symbolSize": 30, + "symbolType": "square" + }, + "range": { + "category": [ + "#ab5787", + "#51b2e5", + "#703c5c", + "#168dd9", + "#d190b6", + "#00609f", + "#d365ba", + "#154866", + "#666666", + "#c4c4c4" + ] + } + }, + "urbaninstitute": { + "background": "#FFFFFF", + "title": { + "anchor": "start", + "fontSize": 18, + "font": "Lato" + }, + "axisX": { + "domain": true, + "domainColor": "#000000", + "domainWidth": 1, + "grid": false, + "labelFontSize": 12, + "labelFont": "Lato", + "labelAngle": 0, + "tickColor": "#000000", + "tickSize": 5, + "titleFontSize": 12, + "titlePadding": 10, + "titleFont": "Lato" + }, + "axisY": { + "domain": false, + "domainWidth": 1, + "grid": true, + "gridColor": "#DEDDDD", + "gridWidth": 1, + "labelFontSize": 12, + "labelFont": "Lato", + "labelPadding": 8, + "ticks": false, + "titleFontSize": 12, + "titlePadding": 10, + "titleFont": "Lato", + "titleAngle": 0, + "titleY": -10, + "titleX": 18 + }, + "legend": { + "labelFontSize": 12, + "labelFont": "Lato", + "symbolSize": 100, + "titleFontSize": 12, + "titlePadding": 10, + "titleFont": "Lato", + "orient": "right", + "offset": 10 + }, + "view": { + "stroke": "transparent" + }, + "range": { + "category": [ + "#1696d2", + "#ec008b", + "#fdbf11", + "#000000", + "#d2d2d2", + "#55b748" + ], + "diverging": [ + "#ca5800", + "#fdbf11", + "#fdd870", + "#fff2cf", + "#cfe8f3", + "#73bfe2", + "#1696d2", + "#0a4c6a" + ], + "heatmap": [ + "#ca5800", + "#fdbf11", + "#fdd870", + "#fff2cf", + "#cfe8f3", + "#73bfe2", + "#1696d2", + "#0a4c6a" + ], + "ordinal": [ + "#cfe8f3", + "#a2d4ec", + "#73bfe2", + "#46abdb", + "#1696d2", + "#12719e" + ], + "ramp": [ + "#CFE8F3", + "#A2D4EC", + "#73BFE2", + "#46ABDB", + "#1696D2", + "#12719E", + "#0A4C6A", + "#062635" + ] + }, + "area": { + "fill": "#1696d2" + }, + "rect": { + "fill": "#1696d2" + }, + "line": { + "color": "#1696d2", + "stroke": "#1696d2", + "strokeWidth": 5 + }, + "trail": { + "color": "#1696d2", + "stroke": "#1696d2", + "strokeWidth": 0, + "size": 1 + }, + "path": { + "stroke": "#1696d2", + "strokeWidth": 0.5 + }, + "point": { + "filled": true + }, + "text": { + "font": "Lato", + "color": "#1696d2", + "fontSize": 11, + "align": "center", + "fontWeight": 400, + "size": 11 + }, + "style": { + "bar": { + "fill": "#1696d2", + "stroke": null + } + }, + "arc": { + "fill": "#1696d2" + }, + "shape": { + "stroke": "#1696d2" + }, + "symbol": { + "fill": "#1696d2", + "size": 30 + } + }, + "vox": { + "background": "#fff", + "arc": { + "fill": "#3e5c69" + }, + "area": { + "fill": "#3e5c69" + }, + "line": { + "stroke": "#3e5c69" + }, + "path": { + "stroke": "#3e5c69" + }, + "rect": { + "fill": "#3e5c69" + }, + "shape": { + "stroke": "#3e5c69" + }, + "symbol": { + "fill": "#3e5c69" + }, + "axis": { + "domainWidth": 0.5, + "grid": true, + "labelPadding": 2, + "tickSize": 5, + "tickWidth": 0.5, + "titleFontWeight": "normal" + }, + "axisBand": { + "grid": false + }, + "axisX": { + "gridWidth": 0.2 + }, + "axisY": { + "gridDash": [ + 3 + ], + "gridWidth": 0.4 + }, + "legend": { + "labelFontSize": 11, + "padding": 1, + "symbolType": "square" + }, + "range": { + "category": [ + "#3e5c69", + "#6793a6", + "#182429", + "#0570b0", + "#3690c0", + "#74a9cf", + "#a6bddb", + "#e2ddf2" + ] + } + } +} \ No newline at end of file diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index df854b78a..3c1e09751 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -14,6 +14,8 @@ from typing import Final, Iterable, Iterator, Literal from urllib import request +import vl_convert as vlc + sys.path.insert(0, str(Path.cwd())) from tools.schemapi import CodeSnippet, SchemaInfo, codegen from tools.schemapi.utils import ( @@ -359,6 +361,10 @@ def download_schemafile( return fp +def update_vega_themes(fp: Path, /, indent: str | int | None = 2) -> None: + fp.write_text(json.dumps(vlc.get_themes(), indent=indent), encoding="utf8") + + def load_schema_with_shorthand_properties(schemapath: Path) -> dict: with schemapath.open(encoding="utf8") as f: schema = json.load(f) @@ -859,6 +865,9 @@ def vegalite_main(skip_download: bool = False) -> None: for fp, contents in files.items(): print(f"Writing\n {schemafile!s}\n ->{fp!s}") ruff_write_lint_format_str(fp, contents) + fp_themes = schemapath / "vega-themes.json" + print(f"Updating themes\n {schemafile!s}\n ->{fp_themes!s}") + update_vega_themes(fp_themes) def _create_encode_signature( From 59588618cb251cf96f4b16ff551615fe013905ad Mon Sep 17 00:00:00 2001 From: Dan Redding <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 5 Aug 2024 21:59:18 +0100 Subject: [PATCH 02/10] Update vega-themes.json --- altair/vegalite/v5/schema/vega-themes.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altair/vegalite/v5/schema/vega-themes.json b/altair/vegalite/v5/schema/vega-themes.json index ca679cd59..e2691376a 100644 --- a/altair/vegalite/v5/schema/vega-themes.json +++ b/altair/vegalite/v5/schema/vega-themes.json @@ -1258,4 +1258,4 @@ ] } } -} \ No newline at end of file +} From 3f073d6209786dbdb540130f78b999b45905d07b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:02:58 +0100 Subject: [PATCH 03/10] fix: Force LF --- altair/vegalite/v5/schema/vega-themes.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altair/vegalite/v5/schema/vega-themes.json b/altair/vegalite/v5/schema/vega-themes.json index e2691376a..ca679cd59 100644 --- a/altair/vegalite/v5/schema/vega-themes.json +++ b/altair/vegalite/v5/schema/vega-themes.json @@ -1258,4 +1258,4 @@ ] } } -} +} \ No newline at end of file From 7e4eb632be1f87b0161e7b3a5d106d5928f785c7 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:04:08 +0100 Subject: [PATCH 04/10] fix: Use `sort_keys` for deterministic `vega-themes.json` --- tools/generate_schema_wrapper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 3c1e09751..60127ceb6 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -362,7 +362,8 @@ def download_schemafile( def update_vega_themes(fp: Path, /, indent: str | int | None = 2) -> None: - fp.write_text(json.dumps(vlc.get_themes(), indent=indent), encoding="utf8") + data = json.dumps(vlc.get_themes(), indent=indent, sort_keys=True) + fp.write_text(data, encoding="utf8") def load_schema_with_shorthand_properties(schemapath: Path) -> dict: From fff8ddc21e3add11022c12e87d6c5fcec63d6167 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:04:30 +0100 Subject: [PATCH 05/10] build: run `generate-schema-wrapper` --- altair/vegalite/v5/schema/vega-themes.json | 872 ++++++++++----------- 1 file changed, 436 insertions(+), 436 deletions(-) diff --git a/altair/vegalite/v5/schema/vega-themes.json b/altair/vegalite/v5/schema/vega-themes.json index ca679cd59..718b87f4c 100644 --- a/altair/vegalite/v5/schema/vega-themes.json +++ b/altair/vegalite/v5/schema/vega-themes.json @@ -1,61 +1,28 @@ { "carbong10": { - "background": "#f4f4f4", "arc": { "fill": "#6929c4" }, "area": { "fill": "#6929c4" }, - "path": { - "stroke": "#6929c4" - }, - "rect": { - "fill": "#6929c4" - }, - "shape": { - "stroke": "#6929c4" - }, - "symbol": { - "stroke": "#6929c4" + "axis": { + "grid": true, + "gridColor": "#525252", + "labelAngle": 0, + "labelColor": "#161616", + "labelFontSize": 12, + "titleColor": "#161616" }, + "background": "#f4f4f4", "circle": { "fill": "#6929c4" }, - "view": { - "fill": "#ffffff", - "stroke": "#ffffff" - }, "group": { "fill": "#ffffff" }, - "title": { - "color": "#161616", - "anchor": "start", - "dy": -15, - "fontSize": 16, - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fontWeight": 600 - }, - "axis": { - "labelColor": "#161616", - "labelFontSize": 12, - "grid": true, - "gridColor": "#525252", - "titleColor": "#161616", - "labelAngle": 0 - }, - "style": { - "guide-label": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#161616", - "fontWeight": 400 - }, - "guide-title": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#161616", - "fontWeight": 400 - } + "path": { + "stroke": "#6929c4" }, "range": { "category": [ @@ -104,65 +71,65 @@ "#31135e", "#1c0f30" ] - } - }, - "carbong100": { - "background": "#161616", - "arc": { - "fill": "#d4bbff" - }, - "area": { - "fill": "#d4bbff" - }, - "path": { - "stroke": "#d4bbff" }, "rect": { - "fill": "#d4bbff" + "fill": "#6929c4" }, "shape": { - "stroke": "#d4bbff" - }, - "symbol": { - "stroke": "#d4bbff" - }, - "circle": { - "fill": "#d4bbff" + "stroke": "#6929c4" }, - "view": { - "fill": "#161616", - "stroke": "#161616" + "style": { + "guide-label": { + "fill": "#161616", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + }, + "guide-title": { + "fill": "#161616", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + } }, - "group": { - "fill": "#161616" + "symbol": { + "stroke": "#6929c4" }, "title": { - "color": "#f4f4f4", "anchor": "start", + "color": "#161616", "dy": -15, - "fontSize": 16, "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontSize": 16, "fontWeight": 600 }, + "view": { + "fill": "#ffffff", + "stroke": "#ffffff" + } + }, + "carbong100": { + "arc": { + "fill": "#d4bbff" + }, + "area": { + "fill": "#d4bbff" + }, "axis": { - "labelColor": "#f4f4f4", - "labelFontSize": 12, "grid": true, "gridColor": "#525252", - "titleColor": "#f4f4f4", - "labelAngle": 0 + "labelAngle": 0, + "labelColor": "#f4f4f4", + "labelFontSize": 12, + "titleColor": "#f4f4f4" }, - "style": { - "guide-label": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#f4f4f4", - "fontWeight": 400 - }, - "guide-title": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#f4f4f4", - "fontWeight": 400 - } + "background": "#161616", + "circle": { + "fill": "#d4bbff" + }, + "group": { + "fill": "#161616" + }, + "path": { + "stroke": "#d4bbff" }, "range": { "category": [ @@ -211,18 +178,6 @@ "#31135e", "#1c0f30" ] - } - }, - "carbong90": { - "background": "#262626", - "arc": { - "fill": "#d4bbff" - }, - "area": { - "fill": "#d4bbff" - }, - "path": { - "stroke": "#d4bbff" }, "rect": { "fill": "#d4bbff" @@ -230,46 +185,58 @@ "shape": { "stroke": "#d4bbff" }, + "style": { + "guide-label": { + "fill": "#f4f4f4", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + }, + "guide-title": { + "fill": "#f4f4f4", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + } + }, "symbol": { "stroke": "#d4bbff" }, - "circle": { - "fill": "#d4bbff" - }, - "view": { - "fill": "#161616", - "stroke": "#161616" - }, - "group": { - "fill": "#161616" - }, "title": { - "color": "#f4f4f4", "anchor": "start", + "color": "#f4f4f4", "dy": -15, - "fontSize": 16, "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontSize": 16, "fontWeight": 600 }, + "view": { + "fill": "#161616", + "stroke": "#161616" + } + }, + "carbong90": { + "arc": { + "fill": "#d4bbff" + }, + "area": { + "fill": "#d4bbff" + }, "axis": { - "labelColor": "#f4f4f4", - "labelFontSize": 12, "grid": true, "gridColor": "#525252", - "titleColor": "#f4f4f4", - "labelAngle": 0 + "labelAngle": 0, + "labelColor": "#f4f4f4", + "labelFontSize": 12, + "titleColor": "#f4f4f4" }, - "style": { - "guide-label": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#f4f4f4", - "fontWeight": 400 - }, - "guide-title": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#f4f4f4", - "fontWeight": 400 - } + "background": "#262626", + "circle": { + "fill": "#d4bbff" + }, + "group": { + "fill": "#161616" + }, + "path": { + "stroke": "#d4bbff" }, "range": { "category": [ @@ -318,65 +285,65 @@ "#31135e", "#1c0f30" ] - } - }, - "carbonwhite": { - "background": "#ffffff", - "arc": { - "fill": "#6929c4" - }, - "area": { - "fill": "#6929c4" - }, - "path": { - "stroke": "#6929c4" }, "rect": { - "fill": "#6929c4" + "fill": "#d4bbff" }, "shape": { - "stroke": "#6929c4" - }, - "symbol": { - "stroke": "#6929c4" - }, - "circle": { - "fill": "#6929c4" + "stroke": "#d4bbff" }, - "view": { - "fill": "#ffffff", - "stroke": "#ffffff" + "style": { + "guide-label": { + "fill": "#f4f4f4", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + }, + "guide-title": { + "fill": "#f4f4f4", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + } }, - "group": { - "fill": "#ffffff" + "symbol": { + "stroke": "#d4bbff" }, "title": { - "color": "#161616", "anchor": "start", + "color": "#f4f4f4", "dy": -15, - "fontSize": 16, "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontSize": 16, "fontWeight": 600 }, + "view": { + "fill": "#161616", + "stroke": "#161616" + } + }, + "carbonwhite": { + "arc": { + "fill": "#6929c4" + }, + "area": { + "fill": "#6929c4" + }, "axis": { - "labelColor": "#161616", - "labelFontSize": 12, "grid": true, "gridColor": "#525252", - "titleColor": "#161616", - "labelAngle": 0 + "labelAngle": 0, + "labelColor": "#161616", + "labelFontSize": 12, + "titleColor": "#161616" }, - "style": { - "guide-label": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#161616", - "fontWeight": 400 - }, - "guide-title": { - "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", - "fill": "#161616", - "fontWeight": 400 - } + "background": "#ffffff", + "circle": { + "fill": "#6929c4" + }, + "group": { + "fill": "#ffffff" + }, + "path": { + "stroke": "#6929c4" }, "range": { "category": [ @@ -425,17 +392,48 @@ "#31135e", "#1c0f30" ] + }, + "rect": { + "fill": "#6929c4" + }, + "shape": { + "stroke": "#6929c4" + }, + "style": { + "guide-label": { + "fill": "#161616", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + }, + "guide-title": { + "fill": "#161616", + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontWeight": 400 + } + }, + "symbol": { + "stroke": "#6929c4" + }, + "title": { + "anchor": "start", + "color": "#161616", + "dy": -15, + "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", + "fontSize": 16, + "fontWeight": 600 + }, + "view": { + "fill": "#ffffff", + "stroke": "#ffffff" } }, "dark": { - "background": "#333", - "view": { - "stroke": "#888" - }, - "title": { - "color": "#fff", - "subtitleColor": "#fff" + "axis": { + "domainColor": "#fff", + "gridColor": "#888", + "tickColor": "#fff" }, + "background": "#333", "style": { "guide-label": { "fill": "#fff" @@ -444,38 +442,21 @@ "fill": "#fff" } }, - "axis": { - "domainColor": "#fff", - "gridColor": "#888", - "tickColor": "#fff" + "title": { + "color": "#fff", + "subtitleColor": "#fff" + }, + "view": { + "stroke": "#888" } }, "excel": { - "background": "#fff", "arc": { "fill": "#4572a7" }, "area": { "fill": "#4572a7" }, - "line": { - "stroke": "#4572a7", - "strokeWidth": 2 - }, - "path": { - "stroke": "#4572a7" - }, - "rect": { - "fill": "#4572a7" - }, - "shape": { - "stroke": "#4572a7" - }, - "symbol": { - "fill": "#4572a7", - "strokeWidth": 1.5, - "size": 50 - }, "axis": { "bandPosition": 0.5, "grid": true, @@ -490,12 +471,20 @@ "grid": false, "tickExtra": true }, + "background": "#fff", "legend": { "labelBaseline": "middle", "labelFontSize": 11, "symbolSize": 50, "symbolType": "square" }, + "line": { + "stroke": "#4572a7", + "strokeWidth": 2 + }, + "path": { + "stroke": "#4572a7" + }, "range": { "category": [ "#4572a7", @@ -509,6 +498,17 @@ "#b9cc98", "#a99cbc" ] + }, + "rect": { + "fill": "#4572a7" + }, + "shape": { + "stroke": "#4572a7" + }, + "symbol": { + "fill": "#4572a7", + "size": 50, + "strokeWidth": 1.5 } }, "fivethirtyeight": { @@ -525,17 +525,22 @@ "gridWidth": 1, "labelColor": "#999", "labelFontSize": 10, - "titleColor": "#333", + "labelPadding": 4, "tickColor": "#cbcbcb", "tickSize": 10, + "titleColor": "#333", "titleFontSize": 14, - "titlePadding": 10, - "labelPadding": 4 + "titlePadding": 10 }, "axisBand": { "grid": false }, "background": "#f0f0f0", + "bar": { + "binSpacing": 2, + "fill": "#30a2da", + "stroke": null + }, "group": { "fill": "#f0f0f0" }, @@ -557,8 +562,9 @@ "stroke": "#30a2da", "strokeWidth": 0.5 }, - "rect": { - "fill": "#30a2da" + "point": { + "filled": true, + "shape": "circle" }, "range": { "category": [ @@ -591,18 +597,12 @@ "#1d78b5" ] }, - "point": { - "filled": true, - "shape": "circle" + "rect": { + "fill": "#30a2da" }, "shape": { "stroke": "#30a2da" }, - "bar": { - "binSpacing": 2, - "fill": "#30a2da", - "stroke": null - }, "title": { "anchor": "start", "fontSize": 24, @@ -611,31 +611,12 @@ } }, "ggplot2": { - "group": { - "fill": "#e5e5e5" - }, "arc": { "fill": "#000" }, "area": { "fill": "#000" }, - "line": { - "stroke": "#000" - }, - "path": { - "stroke": "#000" - }, - "rect": { - "fill": "#000" - }, - "shape": { - "stroke": "#000" - }, - "symbol": { - "fill": "#000", - "size": 40 - }, "axis": { "domain": false, "grid": true, @@ -648,11 +629,20 @@ "titleFontSize": 16, "titleFontWeight": "normal" }, + "group": { + "fill": "#e5e5e5" + }, "legend": { "labelBaseline": "middle", "labelFontSize": 11, "symbolSize": 40 }, + "line": { + "stroke": "#000" + }, + "path": { + "stroke": "#000" + }, "range": { "category": [ "#000000", @@ -666,6 +656,16 @@ "#666666", "#DCDCDC" ] + }, + "rect": { + "fill": "#000" + }, + "shape": { + "stroke": "#000" + }, + "symbol": { + "fill": "#000", + "size": 40 } }, "googlecharts": { @@ -675,54 +675,24 @@ "area": { "fill": "#3366CC" }, - "path": { - "stroke": "#3366CC" - }, - "rect": { - "fill": "#3366CC" - }, - "shape": { - "stroke": "#3366CC" - }, - "symbol": { - "stroke": "#3366CC" + "axis": { + "domain": false, + "grid": true, + "gridColor": "#ccc", + "tickColor": "#ccc" }, + "background": "#fff", "circle": { "fill": "#3366CC" }, - "background": "#fff", "padding": { - "top": 10, - "right": 10, "bottom": 10, - "left": 10 - }, - "style": { - "guide-label": { - "font": "Arial, sans-serif", - "fontSize": 12 - }, - "guide-title": { - "font": "Arial, sans-serif", - "fontSize": 12 - }, - "group-title": { - "font": "Arial, sans-serif", - "fontSize": 12 - } - }, - "title": { - "font": "Arial, sans-serif", - "fontSize": 14, - "fontWeight": "bold", - "dy": -3, - "anchor": "start" + "left": 10, + "right": 10, + "top": 10 }, - "axis": { - "gridColor": "#ccc", - "tickColor": "#ccc", - "domain": false, - "grid": true + "path": { + "stroke": "#3366CC" }, "range": { "category": [ @@ -744,40 +714,45 @@ "#5e97f6", "#2a56c6" ] + }, + "rect": { + "fill": "#3366CC" + }, + "shape": { + "stroke": "#3366CC" + }, + "style": { + "group-title": { + "font": "Arial, sans-serif", + "fontSize": 12 + }, + "guide-label": { + "font": "Arial, sans-serif", + "fontSize": 12 + }, + "guide-title": { + "font": "Arial, sans-serif", + "fontSize": 12 + } + }, + "symbol": { + "stroke": "#3366CC" + }, + "title": { + "anchor": "start", + "dy": -3, + "font": "Arial, sans-serif", + "fontSize": 14, + "fontWeight": "bold" } }, "latimes": { - "background": "#ffffff", - "title": { - "anchor": "start", - "color": "#000000", - "font": "Benton Gothic Bold, sans-serif", - "fontSize": 22, - "fontWeight": "normal" - }, "arc": { "fill": "#82c6df" }, "area": { "fill": "#82c6df" }, - "line": { - "stroke": "#82c6df", - "strokeWidth": 2 - }, - "path": { - "stroke": "#82c6df" - }, - "rect": { - "fill": "#82c6df" - }, - "shape": { - "stroke": "#82c6df" - }, - "symbol": { - "fill": "#82c6df", - "size": 30 - }, "axis": { "labelFont": "Benton Gothic, sans-serif", "labelFontSize": 11.5, @@ -801,6 +776,7 @@ "titleX": -45, "titleY": -11 }, + "background": "#ffffff", "legend": { "labelFont": "Benton Gothic, sans-serif", "labelFontSize": 11.5, @@ -809,6 +785,13 @@ "titleFontSize": 13, "titleFontWeight": "normal" }, + "line": { + "stroke": "#82c6df", + "strokeWidth": 2 + }, + "path": { + "stroke": "#82c6df" + }, "range": { "category": [ "#ec8431", @@ -853,45 +836,57 @@ "#d15a40", "#ab4232" ] + }, + "rect": { + "fill": "#82c6df" + }, + "shape": { + "stroke": "#82c6df" + }, + "symbol": { + "fill": "#82c6df", + "size": 30 + }, + "title": { + "anchor": "start", + "color": "#000000", + "font": "Benton Gothic Bold, sans-serif", + "fontSize": 22, + "fontWeight": "normal" } }, "powerbi": { - "view": { - "stroke": "transparent" + "arc": { + "fill": "#118DFF" }, - "background": "transparent", - "font": "Segoe UI", - "header": { - "titleFont": "wf_standard-font, helvetica, arial, sans-serif", - "titleFontSize": 16, - "titleColor": "#252423", - "labelFont": "Segoe UI", - "labelFontSize": 13.333333333333332, - "labelColor": "#605E5C" + "area": { + "fill": "#118DFF", + "line": true, + "opacity": 0.6 }, "axis": { - "ticks": false, - "grid": false, "domain": false, + "grid": false, "labelColor": "#605E5C", "labelFontSize": 12, - "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "ticks": false, "titleColor": "#252423", + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", "titleFontSize": 16, "titleFontWeight": "normal" }, + "axisBand": { + "tickExtra": true + }, "axisQuantitative": { - "tickCount": 3, "grid": true, "gridColor": "#C8C6C4", "gridDash": [ 1, 5 ], - "labelFlush": false - }, - "axisBand": { - "tickExtra": true + "labelFlush": false, + "tickCount": 3 }, "axisX": { "labelPadding": 5 @@ -899,57 +894,43 @@ "axisY": { "labelPadding": 10 }, + "background": "transparent", "bar": { "fill": "#118DFF" }, + "font": "Segoe UI", + "header": { + "labelColor": "#605E5C", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "titleColor": "#252423", + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "titleFontSize": 16 + }, + "legend": { + "labelColor": "#605E5C", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "symbolSize": 75, + "symbolType": "circle", + "titleColor": "#605E5C", + "titleFont": "Segoe UI", + "titleFontWeight": "bold" + }, "line": { "stroke": "#118DFF", - "strokeWidth": 3, "strokeCap": "round", - "strokeJoin": "round" - }, - "text": { - "font": "Segoe UI", - "fontSize": 12, - "fill": "#605E5C" - }, - "arc": { - "fill": "#118DFF" - }, - "area": { - "fill": "#118DFF", - "line": true, - "opacity": 0.6 + "strokeJoin": "round", + "strokeWidth": 3 }, "path": { "stroke": "#118DFF" }, - "rect": { - "fill": "#118DFF" - }, "point": { "fill": "#118DFF", "filled": true, "size": 75 }, - "shape": { - "stroke": "#118DFF" - }, - "symbol": { - "fill": "#118DFF", - "strokeWidth": 1.5, - "size": 50 - }, - "legend": { - "titleFont": "Segoe UI", - "titleFontWeight": "bold", - "titleColor": "#605E5C", - "labelFont": "Segoe UI", - "labelFontSize": 13.333333333333332, - "labelColor": "#605E5C", - "symbolType": "circle", - "symbolSize": 75 - }, "range": { "category": [ "#118DFF", @@ -981,32 +962,34 @@ "#2898ff", "#118DFF" ] + }, + "rect": { + "fill": "#118DFF" + }, + "shape": { + "stroke": "#118DFF" + }, + "symbol": { + "fill": "#118DFF", + "size": 50, + "strokeWidth": 1.5 + }, + "text": { + "fill": "#605E5C", + "font": "Segoe UI", + "fontSize": 12 + }, + "view": { + "stroke": "transparent" } }, "quartz": { - "background": "#f9f9f9", "arc": { "fill": "#ab5787" }, "area": { "fill": "#ab5787" }, - "line": { - "stroke": "#ab5787" - }, - "path": { - "stroke": "#ab5787" - }, - "rect": { - "fill": "#ab5787" - }, - "shape": { - "stroke": "#ab5787" - }, - "symbol": { - "fill": "#ab5787", - "size": 30 - }, "axis": { "domainColor": "#979797", "domainWidth": 0.5, @@ -1028,12 +1011,19 @@ "grid": true, "tickSize": 0 }, + "background": "#f9f9f9", "legend": { "labelFontSize": 11, "padding": 1, "symbolSize": 30, "symbolType": "square" }, + "line": { + "stroke": "#ab5787" + }, + "path": { + "stroke": "#ab5787" + }, "range": { "category": [ "#ab5787", @@ -1047,28 +1037,38 @@ "#666666", "#c4c4c4" ] + }, + "rect": { + "fill": "#ab5787" + }, + "shape": { + "stroke": "#ab5787" + }, + "symbol": { + "fill": "#ab5787", + "size": 30 } }, "urbaninstitute": { - "background": "#FFFFFF", - "title": { - "anchor": "start", - "fontSize": 18, - "font": "Lato" + "arc": { + "fill": "#1696d2" + }, + "area": { + "fill": "#1696d2" }, "axisX": { "domain": true, "domainColor": "#000000", "domainWidth": 1, "grid": false, - "labelFontSize": 12, - "labelFont": "Lato", "labelAngle": 0, + "labelFont": "Lato", + "labelFontSize": 12, "tickColor": "#000000", "tickSize": 5, + "titleFont": "Lato", "titleFontSize": 12, - "titlePadding": 10, - "titleFont": "Lato" + "titlePadding": 10 }, "axisY": { "domain": false, @@ -1076,29 +1076,39 @@ "grid": true, "gridColor": "#DEDDDD", "gridWidth": 1, - "labelFontSize": 12, "labelFont": "Lato", + "labelFontSize": 12, "labelPadding": 8, "ticks": false, + "titleAngle": 0, + "titleFont": "Lato", "titleFontSize": 12, "titlePadding": 10, - "titleFont": "Lato", - "titleAngle": 0, - "titleY": -10, - "titleX": 18 + "titleX": 18, + "titleY": -10 }, + "background": "#FFFFFF", "legend": { - "labelFontSize": 12, "labelFont": "Lato", + "labelFontSize": 12, + "offset": 10, + "orient": "right", "symbolSize": 100, - "titleFontSize": 12, - "titlePadding": 10, "titleFont": "Lato", - "orient": "right", - "offset": 10 + "titleFontSize": 12, + "titlePadding": 10 }, - "view": { - "stroke": "transparent" + "line": { + "color": "#1696d2", + "stroke": "#1696d2", + "strokeWidth": 5 + }, + "path": { + "stroke": "#1696d2", + "strokeWidth": 0.5 + }, + "point": { + "filled": true }, "range": { "category": [ @@ -1148,78 +1158,52 @@ "#062635" ] }, - "area": { - "fill": "#1696d2" - }, "rect": { "fill": "#1696d2" }, - "line": { - "color": "#1696d2", - "stroke": "#1696d2", - "strokeWidth": 5 - }, - "trail": { - "color": "#1696d2", - "stroke": "#1696d2", - "strokeWidth": 0, - "size": 1 + "shape": { + "stroke": "#1696d2" }, - "path": { - "stroke": "#1696d2", - "strokeWidth": 0.5 + "style": { + "bar": { + "fill": "#1696d2", + "stroke": null + } }, - "point": { - "filled": true + "symbol": { + "fill": "#1696d2", + "size": 30 }, "text": { - "font": "Lato", + "align": "center", "color": "#1696d2", + "font": "Lato", "fontSize": 11, - "align": "center", "fontWeight": 400, "size": 11 }, - "style": { - "bar": { - "fill": "#1696d2", - "stroke": null - } - }, - "arc": { - "fill": "#1696d2" + "title": { + "anchor": "start", + "font": "Lato", + "fontSize": 18 }, - "shape": { - "stroke": "#1696d2" + "trail": { + "color": "#1696d2", + "size": 1, + "stroke": "#1696d2", + "strokeWidth": 0 }, - "symbol": { - "fill": "#1696d2", - "size": 30 + "view": { + "stroke": "transparent" } }, "vox": { - "background": "#fff", "arc": { "fill": "#3e5c69" }, "area": { "fill": "#3e5c69" }, - "line": { - "stroke": "#3e5c69" - }, - "path": { - "stroke": "#3e5c69" - }, - "rect": { - "fill": "#3e5c69" - }, - "shape": { - "stroke": "#3e5c69" - }, - "symbol": { - "fill": "#3e5c69" - }, "axis": { "domainWidth": 0.5, "grid": true, @@ -1240,11 +1224,18 @@ ], "gridWidth": 0.4 }, + "background": "#fff", "legend": { "labelFontSize": 11, "padding": 1, "symbolType": "square" }, + "line": { + "stroke": "#3e5c69" + }, + "path": { + "stroke": "#3e5c69" + }, "range": { "category": [ "#3e5c69", @@ -1256,6 +1247,15 @@ "#a6bddb", "#e2ddf2" ] + }, + "rect": { + "fill": "#3e5c69" + }, + "shape": { + "stroke": "#3e5c69" + }, + "symbol": { + "fill": "#3e5c69" } } } \ No newline at end of file From a9fd435af11c9130a3ffd423f2c667e768c1f84b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:16:37 +0100 Subject: [PATCH 06/10] ci: Introduce `vl_convert` dependency to GH `Test that schema generation has no effect` https://github.com/vega/altair/issues/3519#issuecomment-2267875356 https://github.com/vega/altair/actions/runs/10263632193/job/28395892206?pr=3523 --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf610d104..e32bc5b1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 From 360319a21f42a93072c03cf8dbf1f3f162aa25a4 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:28:37 +0100 Subject: [PATCH 07/10] ci: Output diff when schema generation has an effect Not sure of the right command here, as I can't repro locally --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e32bc5b1e..fc5f08233 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,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 From fa5fe6f93bf6994d582477e6078f5207d8679db6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:12:16 +0100 Subject: [PATCH 08/10] ci: Change gitattributes to always LF --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 176a458f9..6313b56c5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -* text=auto +* text=auto eol=lf From 4c3b189c5fd425cc8831f8621414790d87c8e3a0 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 6 Aug 2024 18:07:47 +0100 Subject: [PATCH 09/10] fix: re-run with fresh env https://github.com/vega/altair/pull/3523#discussion_r1705482605 --- altair/vegalite/v5/schema/vega-themes.json | 78 ++++++++++++++++------ 1 file changed, 59 insertions(+), 19 deletions(-) diff --git a/altair/vegalite/v5/schema/vega-themes.json b/altair/vegalite/v5/schema/vega-themes.json index 718b87f4c..22d8664b8 100644 --- a/altair/vegalite/v5/schema/vega-themes.json +++ b/altair/vegalite/v5/schema/vega-themes.json @@ -8,11 +8,21 @@ }, "axis": { "grid": true, - "gridColor": "#525252", + "gridColor": "#e0e0e0", "labelAngle": 0, - "labelColor": "#161616", + "labelColor": "#525252", + "labelFont": "IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, \".SFNSText-Regular\", sans-serif", "labelFontSize": 12, - "titleColor": "#161616" + "labelFontWeight": 400, + "titleColor": "#161616", + "titleFontSize": 12, + "titleFontWeight": 600 + }, + "axisX": { + "titlePadding": 10 + }, + "axisY": { + "titlePadding": 2.5 }, "background": "#f4f4f4", "circle": { @@ -80,12 +90,12 @@ }, "style": { "guide-label": { - "fill": "#161616", + "fill": "#525252", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 }, "guide-title": { - "fill": "#161616", + "fill": "#525252", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 } @@ -115,11 +125,21 @@ }, "axis": { "grid": true, - "gridColor": "#525252", + "gridColor": "#393939", "labelAngle": 0, - "labelColor": "#f4f4f4", + "labelColor": "#c6c6c6", + "labelFont": "IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, \".SFNSText-Regular\", sans-serif", "labelFontSize": 12, - "titleColor": "#f4f4f4" + "labelFontWeight": 400, + "titleColor": "#f4f4f4", + "titleFontSize": 12, + "titleFontWeight": 600 + }, + "axisX": { + "titlePadding": 10 + }, + "axisY": { + "titlePadding": 2.5 }, "background": "#161616", "circle": { @@ -187,12 +207,12 @@ }, "style": { "guide-label": { - "fill": "#f4f4f4", + "fill": "#c6c6c6", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 }, "guide-title": { - "fill": "#f4f4f4", + "fill": "#c6c6c6", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 } @@ -224,9 +244,19 @@ "grid": true, "gridColor": "#525252", "labelAngle": 0, - "labelColor": "#f4f4f4", + "labelColor": "#c6c6c6", + "labelFont": "IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, \".SFNSText-Regular\", sans-serif", "labelFontSize": 12, - "titleColor": "#f4f4f4" + "labelFontWeight": 400, + "titleColor": "#f4f4f4", + "titleFontSize": 12, + "titleFontWeight": 600 + }, + "axisX": { + "titlePadding": 10 + }, + "axisY": { + "titlePadding": 2.5 }, "background": "#262626", "circle": { @@ -294,12 +324,12 @@ }, "style": { "guide-label": { - "fill": "#f4f4f4", + "fill": "#c6c6c6", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 }, "guide-title": { - "fill": "#f4f4f4", + "fill": "#c6c6c6", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 } @@ -329,11 +359,21 @@ }, "axis": { "grid": true, - "gridColor": "#525252", + "gridColor": "#e0e0e0", "labelAngle": 0, - "labelColor": "#161616", + "labelColor": "#525252", + "labelFont": "IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, \".SFNSText-Regular\", sans-serif", "labelFontSize": 12, - "titleColor": "#161616" + "labelFontWeight": 400, + "titleColor": "#161616", + "titleFontSize": 12, + "titleFontWeight": 600 + }, + "axisX": { + "titlePadding": 10 + }, + "axisY": { + "titlePadding": 2.5 }, "background": "#ffffff", "circle": { @@ -401,12 +441,12 @@ }, "style": { "guide-label": { - "fill": "#161616", + "fill": "#525252", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 }, "guide-title": { - "fill": "#161616", + "fill": "#525252", "font": "IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,\".sfnstext-regular\",sans-serif", "fontWeight": 400 } From c81d3d8ca621efc96e8c2005c0157938ca099015 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 7 Aug 2024 19:06:30 +0100 Subject: [PATCH 10/10] feat(typing): Generate `VegaThemes` alias Resolves the *long-term* solution mentioned in https://github.com/vega/altair/issues/3519#issue-2447214476 --- altair/utils/theme.py | 4 +-- altair/vegalite/v5/schema/_typing.py | 17 +++++++++++ altair/vegalite/v5/theme.py | 42 +++------------------------- tools/generate_schema_wrapper.py | 17 +++++++---- 4 files changed, 34 insertions(+), 46 deletions(-) diff --git a/altair/utils/theme.py b/altair/utils/theme.py index 51929a5fc..02372e690 100644 --- a/altair/utils/theme.py +++ b/altair/utils/theme.py @@ -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. diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 92ffcb794..bcf6d5090 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -56,6 +56,7 @@ "TitleOrient_T", "TypeForShape_T", "Type_T", + "VegaThemes", "WindowOnlyOp_T", ] @@ -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", diff --git a/altair/vegalite/v5/theme.py b/altair/vegalite/v5/theme.py index a3c621658..c98826826 100644 --- a/altair/vegalite/v5/theme.py +++ b/altair/vegalite/v5/theme.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Final, Literal +from typing import TYPE_CHECKING, Final, Literal, get_args from altair.utils.theme import ThemeRegistry +from altair.vegalite.v5.schema._typing import VegaThemes if TYPE_CHECKING: import sys @@ -14,43 +15,8 @@ else: from typing_extensions import TypeAlias - # If you add a theme here, also add it in `VEGA_THEMES` below. - _ThemeName: TypeAlias = Literal[ - "default", - "carbonwhite", - "carbong10", - "carbong90", - "carbong100", - "dark", - "excel", - "fivethirtyeight", - "ggplot2", - "googlecharts", - "latimes", - "opaque", - "powerbi", - "quartz", - "urbaninstitute", - "vox", - ] - -# If you add a theme here, also add it in `_ThemeName` above. -VEGA_THEMES = [ - "carbonwhite", - "carbong10", - "carbong90", - "carbong100", - "dark", - "excel", - "fivethirtyeight", - "ggplot2", - "googlecharts", - "latimes", - "powerbi", - "quartz", - "urbaninstitute", - "vox", -] +AltairThemes: TypeAlias = Literal["default", "opaque"] +VEGA_THEMES: list[str] = list(get_args(VegaThemes)) class VegaTheme: diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 60127ceb6..8ce4b1eb0 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -19,6 +19,7 @@ sys.path.insert(0, str(Path.cwd())) from tools.schemapi import CodeSnippet, SchemaInfo, codegen from tools.schemapi.utils import ( + TypeAliasTracer, get_valid_identifier, indent_docstring, resolve_references, @@ -26,6 +27,7 @@ rst_syntax_for_class, ruff_format_py, ruff_write_lint_format_str, + spell_literal, ) SCHEMA_VERSION: Final = "v5.19.0" @@ -362,9 +364,13 @@ def download_schemafile( def update_vega_themes(fp: Path, /, indent: str | int | None = 2) -> None: - data = json.dumps(vlc.get_themes(), indent=indent, sort_keys=True) + themes = vlc.get_themes() + data = json.dumps(themes, indent=indent, sort_keys=True) fp.write_text(data, encoding="utf8") + theme_names = sorted(iter(themes)) + TypeAliasTracer.update_aliases(("VegaThemes", spell_literal(theme_names))) + def load_schema_with_shorthand_properties(schemapath: Path) -> dict: with schemapath.open(encoding="utf8") as f: @@ -793,6 +799,10 @@ def vegalite_main(skip_download: bool = False) -> None: skip_download=skip_download, ) + fp_themes = schemapath / "vega-themes.json" + print(f"Updating themes\n {schemafile!s}\n ->{fp_themes!s}") + update_vega_themes(fp_themes) + # Generate __init__.py file outfile = schemapath / "__init__.py" print(f"Writing {outfile!s}") @@ -850,8 +860,6 @@ def vegalite_main(skip_download: bool = False) -> None: files[fp_mixins] = content_mixins # Write `_typing.py` TypeAlias, for import in generated modules - from tools.schemapi.utils import TypeAliasTracer - fp_typing = schemapath / "_typing.py" msg = ( f"Generating\n {schemafile!s}\n ->{fp_typing!s}\n" @@ -866,9 +874,6 @@ def vegalite_main(skip_download: bool = False) -> None: for fp, contents in files.items(): print(f"Writing\n {schemafile!s}\n ->{fp!s}") ruff_write_lint_format_str(fp, contents) - fp_themes = schemapath / "vega-themes.json" - print(f"Updating themes\n {schemafile!s}\n ->{fp_themes!s}") - update_vega_themes(fp_themes) def _create_encode_signature(