77
88SpecVersion = Literal ["2021" , "2025" ]
99
10+ COLOR_NAMES = [
11+ # Background & surface base
12+ "background" ,
13+ "onBackground" ,
14+ "surface" ,
15+ "surfaceDim" ,
16+ "surfaceBright" ,
17+
18+ # Surface containers (elevation scale)
19+ "surfaceContainerLowest" ,
20+ "surfaceContainerLow" ,
21+ "surfaceContainer" ,
22+ "surfaceContainerHigh" ,
23+ "surfaceContainerHighest" ,
24+
25+ # Surface content
26+ "onSurface" ,
27+ "surfaceVariant" ,
28+ "onSurfaceVariant" ,
29+
30+ # Outlines & effects
31+ "outline" ,
32+ "outlineVariant" ,
33+ "inverseSurface" ,
34+ "inverseOnSurface" ,
35+ "shadow" ,
36+ "scrim" ,
37+ "surfaceTint" ,
38+
39+ # Primary colors
40+ "primary" ,
41+ "primaryDim" ,
42+ "onPrimary" ,
43+ "primaryContainer" ,
44+ "onPrimaryContainer" ,
45+ "inversePrimary" ,
46+ "primaryFixed" ,
47+ "primaryFixedDim" ,
48+ "onPrimaryFixed" ,
49+ "onPrimaryFixedVariant" ,
50+
51+ # Secondary colors
52+ "secondary" ,
53+ "secondaryDim" ,
54+ "onSecondary" ,
55+ "secondaryContainer" ,
56+ "onSecondaryContainer" ,
57+ "secondaryFixed" ,
58+ "secondaryFixedDim" ,
59+ "onSecondaryFixed" ,
60+ "onSecondaryFixedVariant" ,
61+
62+ # Tertiary colors
63+ "tertiary" ,
64+ "tertiaryDim" ,
65+ "onTertiary" ,
66+ "tertiaryContainer" ,
67+ "onTertiaryContainer" ,
68+ "tertiaryFixed" ,
69+ "tertiaryFixedDim" ,
70+ "onTertiaryFixed" ,
71+ "onTertiaryFixedVariant" ,
72+
73+ # Error colors
74+ "error" ,
75+ "errorDim" ,
76+ "onError" ,
77+ "errorContainer" ,
78+ "onErrorContainer" ,
79+
80+ # Palette key colors
81+ "primaryPaletteKeyColor" ,
82+ "secondaryPaletteKeyColor" ,
83+ "tertiaryPaletteKeyColor" ,
84+ "neutralPaletteKeyColor" ,
85+ "neutralVariantPaletteKeyColor" ,
86+ "errorPaletteKeyColor" ,
87+ ]
88+
1089
1190class ColorSpecDelegate (ABC ):
1291 """
@@ -17,250 +96,11 @@ class ColorSpecDelegate(ABC):
1796 versions.
1897 """
1998
20- # Main Palettes
21- @abstractmethod
22- def primaryPaletteKeyColor (self ) -> "DynamicColor" :
23- pass
24-
25- @abstractmethod
26- def secondaryPaletteKeyColor (self ) -> "DynamicColor" :
27- pass
28-
29- @abstractmethod
30- def tertiaryPaletteKeyColor (self ) -> "DynamicColor" :
31- pass
32-
33- @abstractmethod
34- def neutralPaletteKeyColor (self ) -> "DynamicColor" :
35- pass
36-
37- @abstractmethod
38- def neutralVariantPaletteKeyColor (self ) -> "DynamicColor" :
39- pass
40-
41- @abstractmethod
42- def errorPaletteKeyColor (self ) -> "DynamicColor" :
43- pass
44-
45- # Surfaces [S]
46- @abstractmethod
47- def background (self ) -> "DynamicColor" :
48- pass
49-
50- @abstractmethod
51- def onBackground (self ) -> "DynamicColor" :
52- pass
53-
54- @abstractmethod
55- def surface (self ) -> "DynamicColor" :
56- pass
57-
58- @abstractmethod
59- def surfaceDim (self ) -> "DynamicColor" :
60- pass
61-
62- @abstractmethod
63- def surfaceBright (self ) -> "DynamicColor" :
64- pass
65-
66- @abstractmethod
67- def surfaceContainerLowest (self ) -> "DynamicColor" :
68- pass
69-
70- @abstractmethod
71- def surfaceContainerLow (self ) -> "DynamicColor" :
72- pass
73-
74- @abstractmethod
75- def surfaceContainer (self ) -> "DynamicColor" :
76- pass
77-
78- @abstractmethod
79- def surfaceContainerHigh (self ) -> "DynamicColor" :
80- pass
81-
82- @abstractmethod
83- def surfaceContainerHighest (self ) -> "DynamicColor" :
84- pass
85-
86- @abstractmethod
87- def onSurface (self ) -> "DynamicColor" :
88- pass
89-
90- @abstractmethod
91- def surfaceVariant (self ) -> "DynamicColor" :
92- pass
93-
94- @abstractmethod
95- def onSurfaceVariant (self ) -> "DynamicColor" :
96- pass
97-
98- @abstractmethod
99- def inverseSurface (self ) -> "DynamicColor" :
100- pass
101-
102- @abstractmethod
103- def inverseOnSurface (self ) -> "DynamicColor" :
104- pass
105-
106- @abstractmethod
107- def outline (self ) -> "DynamicColor" :
108- pass
109-
110- @abstractmethod
111- def outlineVariant (self ) -> "DynamicColor" :
112- pass
113-
114- @abstractmethod
115- def shadow (self ) -> "DynamicColor" :
116- pass
117-
118- @abstractmethod
119- def scrim (self ) -> "DynamicColor" :
120- pass
121-
122- @abstractmethod
123- def surfaceTint (self ) -> "DynamicColor" :
124- pass
125-
126- # Primaries [P]
127- @abstractmethod
128- def primary (self ) -> "DynamicColor" :
129- pass
130-
131- @abstractmethod
132- def primaryDim (self ) -> "DynamicColor" :
133- pass
134-
135- @abstractmethod
136- def onPrimary (self ) -> "DynamicColor" :
137- pass
138-
139- @abstractmethod
140- def primaryContainer (self ) -> "DynamicColor" :
141- pass
142-
143- @abstractmethod
144- def onPrimaryContainer (self ) -> "DynamicColor" :
145- pass
146-
147- @abstractmethod
148- def inversePrimary (self ) -> "DynamicColor" :
149- pass
150-
151- # Secondaries [Q]
152- @abstractmethod
153- def secondary (self ) -> "DynamicColor" :
154- pass
155-
156- @abstractmethod
157- def secondaryDim (self ) -> "DynamicColor" :
158- pass
159-
160- @abstractmethod
161- def onSecondary (self ) -> "DynamicColor" :
162- pass
163-
164- @abstractmethod
165- def secondaryContainer (self ) -> "DynamicColor" :
166- pass
167-
168- @abstractmethod
169- def onSecondaryContainer (self ) -> "DynamicColor" :
170- pass
171-
172- # Tertiaries [T]
173- @abstractmethod
174- def tertiary (self ) -> "DynamicColor" :
175- pass
176-
177- @abstractmethod
178- def tertiaryDim (self ) -> "DynamicColor" :
179- pass
180-
181- @abstractmethod
182- def onTertiary (self ) -> "DynamicColor" :
183- pass
184-
185- @abstractmethod
186- def tertiaryContainer (self ) -> "DynamicColor" :
187- pass
188-
189- @abstractmethod
190- def onTertiaryContainer (self ) -> "DynamicColor" :
191- pass
192-
193- # Errors [E]
194- @abstractmethod
195- def error (self ) -> "DynamicColor" :
196- pass
197-
198- @abstractmethod
199- def errorDim (self ) -> "DynamicColor" :
200- pass
201-
202- @abstractmethod
203- def onError (self ) -> "DynamicColor" :
204- pass
205-
206- @abstractmethod
207- def errorContainer (self ) -> "DynamicColor" :
208- pass
209-
210- @abstractmethod
211- def onErrorContainer (self ) -> "DynamicColor" :
212- pass
213-
214- # Primary Fixed Colors [PF]
215- @abstractmethod
216- def primaryFixed (self ) -> "DynamicColor" :
217- pass
218-
219- @abstractmethod
220- def primaryFixedDim (self ) -> "DynamicColor" :
221- pass
222-
223- @abstractmethod
224- def onPrimaryFixed (self ) -> "DynamicColor" :
225- pass
226-
227- @abstractmethod
228- def onPrimaryFixedVariant (self ) -> "DynamicColor" :
229- pass
230-
231- # Secondary Fixed Colors [QF]
232- @abstractmethod
233- def secondaryFixed (self ) -> "DynamicColor" :
234- pass
235-
236- @abstractmethod
237- def secondaryFixedDim (self ) -> "DynamicColor" :
238- pass
239-
240- @abstractmethod
241- def onSecondaryFixed (self ) -> "DynamicColor" :
242- pass
243-
244- @abstractmethod
245- def onSecondaryFixedVariant (self ) -> "DynamicColor" :
246- pass
247-
248- # Tertiary Fixed Colors [TF]
249- @abstractmethod
250- def tertiaryFixed (self ) -> "DynamicColor" :
251- pass
252-
253- @abstractmethod
254- def tertiaryFixedDim (self ) -> "DynamicColor" :
255- pass
256-
257- @abstractmethod
258- def onTertiaryFixed (self ) -> "DynamicColor" :
259- pass
260-
261- @abstractmethod
262- def onTertiaryFixedVariant (self ) -> "DynamicColor" :
263- pass
99+ # define them dynamically
100+ for color_name in COLOR_NAMES :
101+ exec (
102+ f"@abstractmethod\n def { color_name } (self) -> 'DynamicColor':\n \t return None"
103+ )
264104
265105 # Other
266106 @abstractmethod
0 commit comments