The personal finance app for everyone (by everyone)
Ruby
fix(ds): dark-mode token parity — contrast & state fixes (#2139)
Guillem Arias Fauste5abf9cb53772
diff --git a/app/assets/tailwind/sure-design-system/_generated.css b/app/assets/tailwind/sure-design-system/_generated.cssindex 79ae54d430..355025e3bd 100644--- a/app/assets/tailwind/sure-design-system/_generated.css+++ b/app/assets/tailwind/sure-design-system/_generated.css@@ -25,7 +25,7 @@--color-container-inset: var(--color-gray-50);--color-container-inset-hover: var(--color-gray-100);--color-nav-indicator: var(--color-black);- --color-toggle-track: var(--color-gray-100);+ --color-toggle-track: var(--color-gray-300);--color-destructive-subtle: var(--color-red-200);--color-gray-25: #FAFAFA;--color-gray-50: #F7F7F7;@@ -294,7 +294,7 @@@apply text-gray-400;@variant theme-dark {- @apply text-gray-500;+ @apply text-gray-400;}}@@ -342,7 +342,7 @@@apply border-alpha-black-300;@variant theme-dark {- @apply border-alpha-white-400;+ @apply border-alpha-white-500;}}@@ -350,7 +350,7 @@@apply border-alpha-black-200;@variant theme-dark {- @apply border-alpha-white-300;+ @apply border-alpha-white-400;}}@@ -362,7 +362,7 @@@apply border-alpha-black-50;@variant theme-dark {- @apply border-alpha-white-100;+ @apply border-alpha-white-200;}}@@ -375,7 +375,7 @@}@utility border-destructive {- @apply border-red-500;+ @apply border-red-600;@variant theme-dark {@apply border-red-400;@@ -447,7 +447,7 @@}@utility button-bg-destructive {- @apply bg-red-500;+ @apply bg-red-600;@variant theme-dark {@apply bg-red-400;@@ -455,7 +455,7 @@}@utility button-bg-destructive-hover {- @apply bg-red-600;+ @apply bg-red-700;@variant theme-dark {@apply bg-red-500;diff --git a/app/assets/tailwind/sure-design-system/components.css b/app/assets/tailwind/sure-design-system/components.cssindex 7d814388ff..21a133c06b 100644--- a/app/assets/tailwind/sure-design-system/components.css+++ b/app/assets/tailwind/sure-design-system/components.css@@ -109,19 +109,28 @@@variant theme-dark {&[type='checkbox'] {- @apply ring-gray-900 checked:text-white;- background-color: var(--color-gray-100);+ @apply ring-gray-900 border-alpha-white-300;+ background-color: transparent;}&[type='checkbox']:disabled {- @apply cursor-not-allowed opacity-80;- background-color: var(--color-gray-600);+ @apply cursor-not-allowed opacity-80 border-transparent;+ background-color: var(--color-gray-700);}- &[type='checkbox']:checked {- background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%23808080' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");+ &[type='checkbox']:checked,+ &[type='checkbox']:indeterminate {+ @apply border-transparent;background-color: var(--color-gray-100);}++ &[type='checkbox']:checked {+ background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%23171717' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");+ }++ &[type='checkbox']:indeterminate {+ background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%23171717' xmlns='http://www.w3.org/2000/svg'%3e%3crect x='3.5' y='7' width='9' height='2' rx='1'/%3e%3c/svg%3e");+ }}}diff --git a/app/components/DS/buttonish.rb b/app/components/DS/buttonish.rbindex d7fa580a6c..653151f95e 100644--- a/app/components/DS/buttonish.rb+++ b/app/components/DS/buttonish.rb@@ -9,7 +9,7 @@ class DS::Buttonish < DesignSystemComponenticon_classes: "text-primary"},destructive: {- container_classes: "text-inverse bg-red-500 theme-dark:bg-red-400 hover:bg-red-600 theme-dark:hover:bg-red-500 disabled:bg-red-200 theme-dark:disabled:bg-red-600",+ container_classes: "text-inverse bg-red-600 theme-dark:bg-red-400 hover:bg-red-700 theme-dark:hover:bg-red-500 disabled:bg-red-200 theme-dark:disabled:bg-red-600",icon_classes: "text-inverse"},outline: {diff --git a/app/components/DS/pill.rb b/app/components/DS/pill.rbindex b04ef61d6e..c45bf056c1 100644--- a/app/components/DS/pill.rb+++ b/app/components/DS/pill.rb@@ -93,8 +93,13 @@ class DS::Pill < DesignSystemComponentp = palettecase stylewhen :filled+ # Filled = solid / high-emphasis. The tone-500 fill fails white-label AA on+ # the brighter tones (amber 2.4:1, green 2.6:1, red 4.0:1) and glares on dark+ # surfaces. Deepen to tone-700 — every `fill` is a `*-500`, so derive -700 —+ # so the white label clears AA on every tone in both themes.+ strong_fill = p[:fill].sub("-500)", "-700)")<<~CSS.strip.gsub(/\s+/, " ")- background-color: #{p[:fill]};+ background-color: #{strong_fill};color: var(--color-white);border-color: transparent;CSSdiff --git a/app/components/DS/toggle.rb b/app/components/DS/toggle.rbindex e45b69051e..b1a47da4a2 100644--- a/app/components/DS/toggle.rb+++ b/app/components/DS/toggle.rb@@ -24,7 +24,7 @@ class DS::Toggle < DesignSystemComponent# `prefers-reduced-motion`; reduced-motion users get a snap."motion-safe:transition-colors motion-safe:duration-300","after:content-[''] after:block after:bg-white after:absolute after:rounded-full",- "after:top-0.5 after:left-0.5 after:w-4 after:h-4",+ "after:top-0.5 after:left-0.5 after:w-4 after:h-4 after:shadow-sm","motion-safe:after:transition-transform motion-safe:after:duration-300 motion-safe:after:ease-in-out","peer-checked:bg-success peer-checked:after:translate-x-4",# Focus ring driven from the sr-only input via `peer-focus-visible:`.diff --git a/app/views/budget_categories/_budget_category.html.erb b/app/views/budget_categories/_budget_category.html.erbindex 6b55b971e3..647f2e91b3 100644--- a/app/views/budget_categories/_budget_category.html.erb+++ b/app/views/budget_categories/_budget_category.html.erb@@ -38,7 +38,7 @@<%# Progress Bar %><div class="mb-3"><div class="h-1.5 bg-container-inset rounded-full overflow-hidden">- <% bar_color = budget_category.over_budget? ? "bg-red-500" : (budget_category.near_limit? ? "bg-yellow-500" : "bg-green-500") %>+ <% bar_color = budget_category.over_budget? ? "bg-destructive" : (budget_category.near_limit? ? "bg-warning" : "bg-success") %><div class="h-full <%= bar_color %> rounded-full transition-all duration-500"style="inline-size: <%= budget_category.bar_width_percent %>%"></div></div>@@ -67,8 +67,7 @@<div class="w-full sm:w-auto text-xs text-subdued"><%= t("reports.budget_performance.suggested_daily",amount: daily_info[:amount].format,- days: daily_info[:days_remaining])- %>+ days: daily_info[:days_remaining]) %></div><% end %><% end %>diff --git a/design/tokens/sure.tokens.json b/design/tokens/sure.tokens.jsonindex bf36e8743c..82b4a16fed 100644--- a/design/tokens/sure.tokens.json+++ b/design/tokens/sure.tokens.json@@ -35,7 +35,7 @@"container-inset": { "$value": "{color.gray.50}", "$type": "color", "$extensions": { "sure.dark": "{color.gray.800}" } },"container-inset-hover": { "$value": "{color.gray.100}", "$type": "color", "$extensions": { "sure.dark": "{color.gray.700}" } },"nav-indicator": { "$value": "{color.black}", "$type": "color", "$extensions": { "sure.dark": "{color.white}" } },- "toggle-track": { "$value": "{color.gray.100}", "$type": "color", "$extensions": { "sure.dark": "{color.gray.700}" } },+ "toggle-track": { "$value": "{color.gray.300}", "$type": "color", "$extensions": { "sure.dark": "{color.gray.700}" } },"destructive-subtle": { "$value": "{color.red.200}", "$type": "color", "$extensions": { "sure.dark": "{color.red.800}" } },"gray": {@@ -285,7 +285,7 @@"text-primary": { "$type": "utility", "$value": "{color.gray.900}", "$extensions": { "sure.utility": { "prefix": "text" }, "sure.dark": "{color.white}" } },"text-inverse": { "$type": "utility", "$value": "{color.white}", "$extensions": { "sure.utility": { "prefix": "text" }, "sure.dark": "{color.gray.900}" } },"text-secondary": { "$type": "utility", "$value": "{color.gray.500}", "$extensions": { "sure.utility": { "prefix": "text" }, "sure.dark": "{color.gray.300}" } },- "text-subdued": { "$type": "utility", "$value": "{color.gray.400}", "$extensions": { "sure.utility": { "prefix": "text" }, "sure.dark": "{color.gray.500}" } },+ "text-subdued": { "$type": "utility", "$value": "{color.gray.400}", "$extensions": { "sure.utility": { "prefix": "text" }, "sure.dark": "{color.gray.400}" } },"shadow-border-xs": {"$type": "utility",@@ -328,12 +328,12 @@}},- "border-primary": { "$type": "utility", "$value": "{color.alpha-black.300}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.alpha-white.400}" } },- "border-secondary": { "$type": "utility", "$value": "{color.alpha-black.200}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.alpha-white.300}" } },+ "border-primary": { "$type": "utility", "$value": "{color.alpha-black.300}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.alpha-white.500}" } },+ "border-secondary": { "$type": "utility", "$value": "{color.alpha-black.200}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.alpha-white.400}" } },"border-divider": { "$type": "utility", "$value": "border-tertiary" },- "border-subdued": { "$type": "utility", "$value": "{color.alpha-black.50}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.alpha-white.100}" } },+ "border-subdued": { "$type": "utility", "$value": "{color.alpha-black.50}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.alpha-white.200}" } },"border-solid": { "$type": "utility", "$value": "{color.black}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.white}" } },- "border-destructive": { "$type": "utility", "$value": "{color.red.500}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.red.400}" } },+ "border-destructive": { "$type": "utility", "$value": "{color.red.600}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.red.400}" } },"border-inverse": { "$type": "utility", "$value": "{color.alpha-white.200}", "$extensions": { "sure.utility": { "prefix": "border" }, "sure.dark": "{color.alpha-black.300}" } },"button-bg-primary": { "$type": "utility", "$value": "{color.gray.900}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.white}" } },@@ -343,8 +343,8 @@"button-bg-secondary-strong": { "$type": "utility", "$value": "{color.gray.200}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.gray.700}" } },"button-bg-secondary-strong-hover": { "$type": "utility", "$value": "{color.gray.300}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.gray.600}" } },"button-bg-disabled": { "$type": "utility", "$value": "{color.gray.50}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.gray.700}" } },- "button-bg-destructive": { "$type": "utility", "$value": "{color.red.500}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.red.400}" } },- "button-bg-destructive-hover": { "$type": "utility", "$value": "{color.red.600}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.red.500}" } },+ "button-bg-destructive": { "$type": "utility", "$value": "{color.red.600}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.red.400}" } },+ "button-bg-destructive-hover": { "$type": "utility", "$value": "{color.red.700}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.red.500}" } },"button-bg-ghost-hover": { "$type": "utility", "$value": "{color.gray.50}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "bg-gray-800 text-inverse" } },"button-bg-outline-hover": { "$type": "utility", "$value": "{color.gray.100}", "$extensions": { "sure.utility": { "prefix": "bg" }, "sure.dark": "{color.gray.700}" } },