diff --git a/src/styles/style-nova.css b/src/styles/style-nova.css index f0c11211..c1d7f653 100644 --- a/src/styles/style-nova.css +++ b/src/styles/style-nova.css @@ -38,7 +38,7 @@ button:outline:hover, button:primary, .button-primary { - @apply border-transparent bg-primary text-primary-foreground dark:bg-primary-dark dark:text-primary-foreground-dark; + @apply border-transparent bg-primary text-primary-foreground dark:border-transparent dark:bg-primary-dark dark:text-primary-foreground-dark; } button:primary:hover, @@ -58,7 +58,7 @@ button:secondary:hover, button:ghost, .button-ghost { - @apply border-transparent bg-transparent text-foreground dark:text-foreground-dark; + @apply border-transparent bg-transparent text-foreground dark:border-transparent dark:text-foreground-dark; } button:ghost:hover, @@ -68,7 +68,7 @@ button:ghost:hover, button:destructive, .button-destructive { - @apply border-transparent bg-destructive-muted text-destructive dark:bg-destructive-muted-dark dark:text-destructive-dark; + @apply border-transparent bg-destructive-muted text-destructive dark:border-transparent dark:bg-destructive-muted-dark dark:text-destructive-dark; } button:destructive:hover, @@ -78,12 +78,12 @@ button:destructive:hover, button:link, .button-link { - @apply border-transparent bg-transparent text-primary dark:text-primary-dark; + @apply border-transparent bg-transparent text-primary dark:border-transparent dark:text-primary-dark; } button:link:hover, .button-link:hover { - @apply bg-transparent text-primary dark:text-primary-dark; + @apply bg-transparent text-primary dark:bg-transparent dark:text-primary-dark; } button:link, @@ -179,7 +179,7 @@ button:destructive:active { button:link:active, .button-link:active { - @apply bg-transparent text-primary underline dark:text-primary-dark; + @apply bg-transparent text-primary underline dark:bg-transparent dark:text-primary-dark; } button .fui-icon { diff --git a/src/styles/style-nova.css.h b/src/styles/style-nova.css.h index e7ac1ef2..80a306f9 100644 --- a/src/styles/style-nova.css.h +++ b/src/styles/style-nova.css.h @@ -84,6 +84,7 @@ static const struct { { " color: #fafafa;\n", 18 }, { "}\n", 2 }, { ".dark button:primary, .dark .button-primary {\r\n", 47 }, + { " border-color: transparent;\r\n", 30 }, { " background-color: #fafafa;\r\n", 30 }, { " color: #171717;\n", 18 }, { "}\n", 2 }, @@ -124,6 +125,7 @@ static const struct { { " color: #0a0a0a;\n", 18 }, { "}\n", 2 }, { ".dark button:ghost, .dark .button-ghost {\r\n", 43 }, + { " border-color: transparent;\r\n", 30 }, { " color: #fafafa;\n", 18 }, { "}\n", 2 }, { "button:ghost:hover,\r\n", 21 }, @@ -142,6 +144,7 @@ static const struct { { " color: #e7000b;\n", 18 }, { "}\n", 2 }, { ".dark button:destructive, .dark .button-destructive {\r\n", 55 }, + { " border-color: transparent;\r\n", 30 }, { " background-color: #4c0519;\r\n", 30 }, { " color: #ff6467;\n", 18 }, { "}\n", 2 }, @@ -163,6 +166,7 @@ static const struct { { " color: #171717;\n", 18 }, { "}\n", 2 }, { ".dark button:link, .dark .button-link {\r\n", 41 }, + { " border-color: transparent;\r\n", 30 }, { " color: #fafafa;\n", 18 }, { "}\n", 2 }, { "button:link:hover,\r\n", 20 }, @@ -171,6 +175,7 @@ static const struct { { " color: #171717;\n", 18 }, { "}\n", 2 }, { ".dark button:link:hover, .dark .button-link:hover {\r\n", 53 }, + { " background-color: transparent;\r\n", 34 }, { " color: #fafafa;\n", 18 }, { "}\n", 2 }, { "button:link,\r\n", 14 }, @@ -312,6 +317,7 @@ static const struct { { " text-decoration-line: underline;\n", 35 }, { "}\n", 2 }, { ".dark button:link:active, .dark .button-link:active {\r\n", 55 }, + { " background-color: transparent;\r\n", 34 }, { " color: #fafafa;\n", 18 }, { "}\n", 2 }, { "button .fui-icon {\r\n", 20 }, @@ -2438,7 +2444,7 @@ static const struct { { " background-color: rgb(250 250 250 / 0.6);\n", 44 }, { "}\n", 2 }, }; -static const size_t css_str_style_nova_total_length = 48512; +static const size_t css_str_style_nova_total_length = 48700; static inline void ui_load_css_string_style_nova_chunks(void) { size_t i; diff --git a/tests/integration/test_style_nova.c b/tests/integration/test_style_nova.c index ad632978..4db62c3c 100644 --- a/tests/integration/test_style_nova.c +++ b/tests/integration/test_style_nova.c @@ -524,6 +524,64 @@ static void check_button_class_variants(void) ui_clear_trash(); } +static void check_button_variant_borders_in_dark(void) +{ + ui_widget_t *link = ui_create_widget("button"); + ui_widget_t *primary = ui_create_widget("button"); + ui_widget_t *ghost = ui_create_widget("button"); + + ui_widget_add_class(link, "button-link"); + ui_widget_add_class(primary, "button-primary"); + ui_widget_add_class(ghost, "button-ghost"); + ui_widget_append(ui_root(), link); + ui_widget_append(ui_root(), primary); + ui_widget_append(ui_root(), ghost); + ui_widget_add_class(ui_root(), "dark"); + ui_update(); + + ctest_equal_int("dark link button border should stay transparent", + (link->computed_style.border_top_color >> 24) & 0xff, + 0); + ctest_equal_int("dark primary button border should stay transparent", + (primary->computed_style.border_top_color >> 24) & 0xff, + 0); + ctest_equal_int("dark ghost button border should stay transparent", + (ghost->computed_style.border_top_color >> 24) & 0xff, + 0); + + ui_widget_remove_class(ui_root(), "dark"); + ui_widget_destroy(link); + ui_widget_destroy(primary); + ui_widget_destroy(ghost); + ui_clear_trash(); +} + +static void check_link_button_has_no_background_in_dark(void) +{ + ui_widget_t *link = ui_create_widget("button"); + + ui_widget_add_class(link, "button-link"); + ui_widget_append(ui_root(), link); + ui_widget_add_class(ui_root(), "dark"); + + ui_widget_add_status(link, "hover"); + ui_update(); + ctest_equal_int( + "dark link button hover should keep a transparent background", + (link->computed_style.background_color >> 24) & 0xff, 0); + + ui_widget_remove_status(link, "hover"); + ui_widget_add_status(link, "active"); + ui_update(); + ctest_equal_int( + "dark link button active should keep a transparent background", + (link->computed_style.background_color >> 24) & 0xff, 0); + + ui_widget_remove_class(ui_root(), "dark"); + ui_widget_destroy(link); + ui_clear_trash(); +} + void test_style_nova(void) { lcui_init(); @@ -539,6 +597,10 @@ void test_style_nova(void) check_button_icon_typography); ctest_describe("style-nova: button interaction", check_button_interaction_style); + ctest_describe("style-nova: button variant borders in dark", + check_button_variant_borders_in_dark); + ctest_describe("style-nova: link button background in dark", + check_link_button_has_no_background_in_dark); ctest_describe("style-nova: badge", check_badge_typography); ctest_describe("style-nova: item", check_item_typography); ctest_describe("style-nova: tooltip typography",