@@ -17,28 +17,30 @@ def load_palette_json() -> dict[str, Any]:
1717 return cast (dict [str , Any ], json .load (f ))
1818
1919
20- def make_color (fields : dict [str , Any ]) -> Color :
20+ def make_color (identifier : str , fields : dict [str , Any ]) -> Color :
2121 """Create a Color instance from a set of fields."""
2222 return Color (
2323 name = fields ["name" ],
24+ identifier = identifier ,
25+ accent = fields ["accent" ],
2426 order = fields ["order" ],
2527 hex = fields ["hex" ],
2628 rgb = RGB (** fields ["rgb" ]),
2729 hsl = HSL (** fields ["hsl" ]),
28- accent = fields ["accent" ],
2930 )
3031
3132
32- def make_flavor (fields : dict [str , Any ]) -> Flavor :
33+ def make_flavor (identifier : str , fields : dict [str , Any ]) -> Flavor :
3334 """Create a Flavor instance from a set of fields."""
3435 return Flavor (
3536 name = fields ["name" ],
37+ identifier = identifier ,
3638 order = fields ["order" ],
3739 dark = fields ["dark" ],
3840 colors = FlavorColors (
3941 ** {
40- color_name : make_color (color_data )
41- for color_name , color_data in fields ["colors" ].items ()
42+ identifier : make_color (identifier , fields )
43+ for identifier , fields in fields ["colors" ].items ()
4244 }
4345 ),
4446 )
@@ -48,7 +50,10 @@ def codegen() -> str:
4850 """Generate contents of `catppuccin/palette.py`."""
4951 palette_json = load_palette_json ()
5052 palette = Palette (
51- * [make_flavor (flavor_data ) for flavor_data in palette_json .values ()]
53+ * [
54+ make_flavor (identifier , fields )
55+ for identifier , fields in palette_json .items ()
56+ ]
5257 )
5358
5459 lines = [
0 commit comments