Skip to content

Commit d0ab500

Browse files
jawinncastastrophe
authored andcommitted
feat: add example gradients for static black and white (#2637)
* feat: add example gradients for static black and white Add new gradient backgrounds, displayed for static black and static white variants. These are used for examples only. This adds CSS custom properties available globally within Storybook and sets them on the existing decorator. * docs(fieldlabel): support static colors decorator in storybook Change Field label stories that show static black and static white, so they work with the recently added decorator that changes the main Storybook background. * docs(button): adjust static colors template Adjust static colors template to better handle the static color decorator and gradients. * chore(fieldlabel): apply eslint indentation changes to stories
1 parent 624a480 commit d0ab500

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

.storybook/decorators/context.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ export const withContextWrapper = makeDecorator({
3131

3232
const staticColorSettings = {
3333
"black": {
34-
background: "var(--spectrum-docs-static-black-background-color)",
34+
background: "var(--spectrum-examples-gradient-static-black)",
3535
color: "light"
3636
},
3737
"white": {
38-
background: "var(--spectrum-docs-static-white-background-color)",
38+
background: "var(--spectrum-examples-gradient-static-white)",
3939
color: "dark"
4040
},
4141
};

tokens/custom/global-vars.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@
5757
--spectrum-cjk-font-family-stack: adobe-clean-han-japanese, var(--spectrum-cjk-font-family), sans-serif;
5858
--spectrum-cjk-font: var(--spectrum-code-font-family-stack);
5959

60-
/* static white / black background color for docs containers */
61-
--spectrum-docs-static-white-background-color: rgb(15 121 125);
62-
--spectrum-docs-static-black-background-color: rgb(181 209 211);
60+
/* Gradient that changes with the color theme. */
61+
--spectrum-examples-gradient: linear-gradient(45deg, var(--spectrum-magenta-1500), var(--spectrum-blue-1500));
62+
63+
/* Gradients that do not change with the color theme, for use in static color backgrounds. */
64+
--spectrum-examples-gradient-static-black: linear-gradient(45deg, rgb(255 241 246), rgb(238 245 255));
65+
--spectrum-examples-gradient-static-white: linear-gradient(45deg, rgb(64 0 22), rgb(14 24 67));
6366

6467
--spectrum-coach-indicator-ring-static-white-color: var(--spectrum-white);
6568

tokens/dist/css/global-vars.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,10 +811,9 @@
811811
--spectrum-font-size: var(--spectrum-font-size-100);
812812
--spectrum-cjk-font-family-stack: adobe-clean-han-japanese, var(--spectrum-cjk-font-family), sans-serif;
813813
--spectrum-cjk-font: var(--spectrum-code-font-family-stack);
814-
--spectrum-docs-static-white-background-color-rgb: 15, 121, 125;
815-
--spectrum-docs-static-white-background-color: rgba(var(--spectrum-docs-static-white-background-color-rgb));
816-
--spectrum-docs-static-black-background-color-rgb: 181, 209, 211;
817-
--spectrum-docs-static-black-background-color: rgba(var(--spectrum-docs-static-black-background-color-rgb));
814+
--spectrum-examples-gradient: linear-gradient(45deg, var(--spectrum-magenta-1500), var(--spectrum-blue-1500));
815+
--spectrum-examples-gradient-static-black: linear-gradient(45deg, rgb(255, 241, 246), rgb(238, 245, 255));
816+
--spectrum-examples-gradient-static-white: linear-gradient(45deg, rgb(64, 0, 22), rgb(14, 24, 67));
818817
--spectrum-coach-indicator-ring-static-white-color: var(--spectrum-white);
819818
--spectrum-corner-radius-1000: 9999px;
820819
}

tokens/dist/css/index.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,10 +1535,9 @@
15351535
--spectrum-font-size: var(--spectrum-font-size-100);
15361536
--spectrum-cjk-font-family-stack: adobe-clean-han-japanese, var(--spectrum-cjk-font-family), sans-serif;
15371537
--spectrum-cjk-font: var(--spectrum-code-font-family-stack);
1538-
--spectrum-docs-static-white-background-color-rgb: 15, 121, 125;
1539-
--spectrum-docs-static-white-background-color: rgba(var(--spectrum-docs-static-white-background-color-rgb));
1540-
--spectrum-docs-static-black-background-color-rgb: 181, 209, 211;
1541-
--spectrum-docs-static-black-background-color: rgba(var(--spectrum-docs-static-black-background-color-rgb));
1538+
--spectrum-examples-gradient: linear-gradient(45deg, var(--spectrum-magenta-1500), var(--spectrum-blue-1500));
1539+
--spectrum-examples-gradient-static-black: linear-gradient(45deg, rgb(255, 241, 246), rgb(238, 245, 255));
1540+
--spectrum-examples-gradient-static-white: linear-gradient(45deg, rgb(64, 0, 22), rgb(14, 24, 67));
15421541
--spectrum-coach-indicator-ring-static-white-color: var(--spectrum-white);
15431542
--spectrum-corner-radius-1000: 9999px;
15441543
}

tokens/dist/index.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,10 +1535,9 @@
15351535
--spectrum-font-size: var(--spectrum-font-size-100);
15361536
--spectrum-cjk-font-family-stack: adobe-clean-han-japanese, var(--spectrum-cjk-font-family), sans-serif;
15371537
--spectrum-cjk-font: var(--spectrum-code-font-family-stack);
1538-
--spectrum-docs-static-white-background-color-rgb: 15, 121, 125;
1539-
--spectrum-docs-static-white-background-color: rgba(var(--spectrum-docs-static-white-background-color-rgb));
1540-
--spectrum-docs-static-black-background-color-rgb: 181, 209, 211;
1541-
--spectrum-docs-static-black-background-color: rgba(var(--spectrum-docs-static-black-background-color-rgb));
1538+
--spectrum-examples-gradient: linear-gradient(45deg, var(--spectrum-magenta-1500), var(--spectrum-blue-1500));
1539+
--spectrum-examples-gradient-static-black: linear-gradient(45deg, rgb(255, 241, 246), rgb(238, 245, 255));
1540+
--spectrum-examples-gradient-static-white: linear-gradient(45deg, rgb(64, 0, 22), rgb(14, 24, 67));
15421541
--spectrum-coach-indicator-ring-static-white-color: var(--spectrum-white);
15431542
--spectrum-corner-radius-1000: 9999px;
15441543
}

0 commit comments

Comments
 (0)