|
@@ -32,38 +32,38 @@ def create_color_var(color):
|
|
(create_color_var(rx.color("mint", 3, True)), '"var(--mint-a3)"', Color),
|
|
(create_color_var(rx.color("mint", 3, True)), '"var(--mint-a3)"', Color),
|
|
(
|
|
(
|
|
create_color_var(rx.color(ColorState.color, ColorState.shade)), # type: ignore
|
|
create_color_var(rx.color(ColorState.color, ColorState.shade)), # type: ignore
|
|
- f'("var(--"+{str(color_state_name)}.color+"-"+(((__to_string) => __to_string.toString())({str(color_state_name)}.shade))+")")',
|
|
|
|
|
|
+ f'("var(--"+{color_state_name!s}.color+"-"+(((__to_string) => __to_string.toString())({color_state_name!s}.shade))+")")',
|
|
Color,
|
|
Color,
|
|
),
|
|
),
|
|
(
|
|
(
|
|
create_color_var(
|
|
create_color_var(
|
|
rx.color(ColorState.color, ColorState.shade, ColorState.alpha) # type: ignore
|
|
rx.color(ColorState.color, ColorState.shade, ColorState.alpha) # type: ignore
|
|
),
|
|
),
|
|
- f'("var(--"+{str(color_state_name)}.color+"-"+({str(color_state_name)}.alpha ? "a" : "")+(((__to_string) => __to_string.toString())({str(color_state_name)}.shade))+")")',
|
|
|
|
|
|
+ f'("var(--"+{color_state_name!s}.color+"-"+({color_state_name!s}.alpha ? "a" : "")+(((__to_string) => __to_string.toString())({color_state_name!s}.shade))+")")',
|
|
Color,
|
|
Color,
|
|
),
|
|
),
|
|
(
|
|
(
|
|
create_color_var(rx.color(f"{ColorState.color}", f"{ColorState.shade}")), # type: ignore
|
|
create_color_var(rx.color(f"{ColorState.color}", f"{ColorState.shade}")), # type: ignore
|
|
- f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")',
|
|
|
|
|
|
+ f'("var(--"+{color_state_name!s}.color+"-"+{color_state_name!s}.shade+")")',
|
|
Color,
|
|
Color,
|
|
),
|
|
),
|
|
(
|
|
(
|
|
create_color_var(
|
|
create_color_var(
|
|
rx.color(f"{ColorState.color_part}ato", f"{ColorState.shade}") # type: ignore
|
|
rx.color(f"{ColorState.color_part}ato", f"{ColorState.shade}") # type: ignore
|
|
),
|
|
),
|
|
- f'("var(--"+({str(color_state_name)}.color_part+"ato")+"-"+{str(color_state_name)}.shade+")")',
|
|
|
|
|
|
+ f'("var(--"+({color_state_name!s}.color_part+"ato")+"-"+{color_state_name!s}.shade+")")',
|
|
Color,
|
|
Color,
|
|
),
|
|
),
|
|
(
|
|
(
|
|
create_color_var(f'{rx.color(ColorState.color, f"{ColorState.shade}")}'), # type: ignore
|
|
create_color_var(f'{rx.color(ColorState.color, f"{ColorState.shade}")}'), # type: ignore
|
|
- f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")',
|
|
|
|
|
|
+ f'("var(--"+{color_state_name!s}.color+"-"+{color_state_name!s}.shade+")")',
|
|
str,
|
|
str,
|
|
),
|
|
),
|
|
(
|
|
(
|
|
create_color_var(
|
|
create_color_var(
|
|
f'{rx.color(f"{ColorState.color}", f"{ColorState.shade}")}' # type: ignore
|
|
f'{rx.color(f"{ColorState.color}", f"{ColorState.shade}")}' # type: ignore
|
|
),
|
|
),
|
|
- f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")',
|
|
|
|
|
|
+ f'("var(--"+{color_state_name!s}.color+"-"+{color_state_name!s}.shade+")")',
|
|
str,
|
|
str,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
@@ -82,7 +82,7 @@ def test_color(color, expected, expected_type: Union[Type[str], Type[Color]]):
|
|
),
|
|
),
|
|
(
|
|
(
|
|
rx.cond(True, rx.color(ColorState.color), rx.color(ColorState.color, 5)), # type: ignore
|
|
rx.cond(True, rx.color(ColorState.color), rx.color(ColorState.color, 5)), # type: ignore
|
|
- f'(true ? ("var(--"+{str(color_state_name)}.color+"-7)") : ("var(--"+{str(color_state_name)}.color+"-5)"))',
|
|
|
|
|
|
+ f'(true ? ("var(--"+{color_state_name!s}.color+"-7)") : ("var(--"+{color_state_name!s}.color+"-5)"))',
|
|
),
|
|
),
|
|
(
|
|
(
|
|
rx.match(
|
|
rx.match(
|
|
@@ -93,7 +93,7 @@ def test_color(color, expected, expected_type: Union[Type[str], Type[Color]]):
|
|
),
|
|
),
|
|
'(() => { switch (JSON.stringify("condition")) {case JSON.stringify("first"): return ("var(--mint-7)");'
|
|
'(() => { switch (JSON.stringify("condition")) {case JSON.stringify("first"): return ("var(--mint-7)");'
|
|
' break;case JSON.stringify("second"): return ("var(--tomato-5)"); break;default: '
|
|
' break;case JSON.stringify("second"): return ("var(--tomato-5)"); break;default: '
|
|
- f'return (("var(--"+{str(color_state_name)}.color+"-2)")); break;}};}})()',
|
|
|
|
|
|
+ f'return (("var(--"+{color_state_name!s}.color+"-2)")); break;}};}})()',
|
|
),
|
|
),
|
|
(
|
|
(
|
|
rx.match(
|
|
rx.match(
|
|
@@ -103,9 +103,9 @@ def test_color(color, expected, expected_type: Union[Type[str], Type[Color]]):
|
|
rx.color(ColorState.color, 2), # type: ignore
|
|
rx.color(ColorState.color, 2), # type: ignore
|
|
),
|
|
),
|
|
'(() => { switch (JSON.stringify("condition")) {case JSON.stringify("first"): '
|
|
'(() => { switch (JSON.stringify("condition")) {case JSON.stringify("first"): '
|
|
- f'return (("var(--"+{str(color_state_name)}.color+"-7)")); break;case JSON.stringify("second"): '
|
|
|
|
- f'return (("var(--"+{str(color_state_name)}.color+"-5)")); break;default: '
|
|
|
|
- f'return (("var(--"+{str(color_state_name)}.color+"-2)")); break;}};}})()',
|
|
|
|
|
|
+ f'return (("var(--"+{color_state_name!s}.color+"-7)")); break;case JSON.stringify("second"): '
|
|
|
|
+ f'return (("var(--"+{color_state_name!s}.color+"-5)")); break;default: '
|
|
|
|
+ f'return (("var(--"+{color_state_name!s}.color+"-2)")); break;}};}})()',
|
|
),
|
|
),
|
|
],
|
|
],
|
|
)
|
|
)
|