Skip to content

Commit dcc8d0d

Browse files
committedJun 8, 2024
feat: new coloring system
1 parent e603df7 commit dcc8d0d

File tree

12 files changed

+31
-30
lines changed

12 files changed

+31
-30
lines changed
 

‎apps/web/src/app/docs/components/colors/colors.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@for (color of colors; track color) {
22
<div class="color">
33
<div class="title">{{ color }}</div>
4+
45
@for (token of tokens; track token) {
56
<div class="token" [style]="getVariable(color, token)" #element>
67
<span>{{ token }}</span>

‎apps/web/src/app/docs/components/colors/colors.component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Component } from '@angular/core';
88
styleUrl: './colors.component.scss'
99
})
1010
export class ColorsComponent {
11-
colors = ['primary', 'primary-alt', 'secondary', 'success', 'error', 'info', 'warning', 'dark'];
11+
colors = ['primary', 'primary-alt', 'secondary', 'success', 'error', 'info', 'warning', 'background'];
1212
tokens = [
1313
100, 130, 160, 200, 230, 260, 300, 330, 345, 360, 400, 430, 460, 500, 530, 560, 600, 630, 660, 700, 730, 760, 800,
1414
830, 860, 900
@@ -19,7 +19,6 @@ export class ColorsComponent {
1919
}
2020

2121
getColor(element: HTMLElement) {
22-
// console.log(getComputedStyle(element).getPropertyValue('background-color'));
2322
return getComputedStyle(element).getPropertyValue('background-color').replace('oklch(', '').replace(')', '');
2423
}
2524
}

‎apps/web/src/app/docs/components/example/example.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
border-bottom-left-radius: 4px;
1515
border-bottom-right-radius: 4px;
1616

17-
background-color: var(--color-bg-tertiary);
17+
background-color: var(--color-bg-secondary-alt);
1818

1919
.x-icon {
2020
font-size: 20px;
@@ -38,7 +38,7 @@
3838
}
3939

4040
xui-card {
41-
background-color: var(--color-bg-floating);
41+
background-color: var(--color-bg-secondary);
4242
}
4343

4444
code {

‎apps/web/src/styles.scss

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use './highlightjs';
22
@use '@xui/theme-default';
3-
43
// with (
54
// $enable-rounded: true,
65
// $banner-stamp-border-radius: 20px,
@@ -12,8 +11,6 @@
1211

1312
@include theme-default.theme();
1413

15-
// end user should be able to change swatches/colors but the overall theme such as border-radius should be compile time
16-
1714
code {
1815
font-family: Consolas, Monospaced, sans-serif;
1916
font-size: 10pt;

‎apps/web/src/themes/xui-dark.theme.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ $theme: xui.define-dark-theme(
55
color: (
66
primary: xui.define-palette(xui.generate-palette(55.88% 0.154 252.84)),
77
primary-alt: xui.define-palette(xui.$purple-palette),
8-
secondary: xui.define-palette(xui.$orange-palette),
9-
dark: xui.define-palette(xui.$dark-palette)
8+
secondary: xui.define-palette(xui.$orange-palette)
109
)
1110
)
1211
);

‎libs/theme-core/src/theming/theming.scss

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
success: map.get($color, success) or define-palette(theme.$green-palette),
8383
warning: map.get($color, warning) or define-palette(theme.$orange-palette),
8484
error: map.get($color, error) or define-palette(theme.$red-palette),
85+
background: map.get($color, error) or define-palette(theme.$background-palette),
8586
bg: map.get($color, bg) or define-background-palette($default-background)
8687
)
8788
);

‎libs/theme-core/src/theming/xui.theme.scss

+15-16
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ $dark-primary-text: 0 0 0;
44
$light-primary-text: 89.7% 0.011 243.67;
55

66
$background-dark-palette: (
7-
primary: 33.66% 0.011 236.92,
8-
secondary: 31.03% 0.011 248.19,
9-
secondary-alt: 28.58% 0.01 242.05,
10-
tertiary: 25.74% 0.012 248.29,
11-
accent: 43.95% 0.01 248.07,
12-
floating: 20.56% 0.011 242.31,
13-
7+
primary: var(--color-background-600-lch),
8+
secondary: var(--color-background-630-lch),
9+
secondary-alt: var(--color-background-660-lch),
10+
tertiary: var(--color-background-700-lch),
11+
accent: var(--color-background-530-lch),
12+
floating: var(--color-background-800-lch),
1413
contrast: (
1514
primary: $light-primary-text,
1615
secondary: $light-primary-text,
@@ -22,19 +21,19 @@ $background-dark-palette: (
2221
);
2322

2423
$background-light-palette: (
25-
primary: 100% 0 0,
26-
secondary: 96.4% 0.003 264.54,
27-
secondary-alt: 94.48% 0.003 247.86,
28-
tertiary: 92.12% 0.005 258.33,
29-
accent: 55.47% 0.022 253.46,
30-
floating: 100% 0 0,
24+
primary: white,
25+
secondary: var(--color-background-130-lch),
26+
secondary-alt: var(--color-background-160-lch),
27+
tertiary: var(--color-background-200-lch),
28+
accent: var(--color-background-430-lch),
29+
floating: var(--color-background-500-lch),
3130
contrast: (
3231
primary: $dark-primary-text,
3332
secondary: $dark-primary-text,
3433
secondary-alt: $dark-primary-text,
3534
tertiary: $dark-primary-text,
36-
accent: $dark-primary-text,
37-
floating: $dark-primary-text
35+
accent: $light-primary-text,
36+
floating: $light-primary-text
3837
)
3938
);
4039

@@ -54,4 +53,4 @@ $red-palette: palette.generate-palette(58.07% 0.215 31.56);
5453
$green-palette: palette.generate-palette(54.27% 0.134 153.22);
5554
$orange-palette: palette.generate-palette(56.53% 0.13 61.8);
5655
$purple-palette: palette.generate-palette(55.68% 0.176 293.4);
57-
$dark-palette: palette.generate-palette(43.19% 0.011 236.92);
56+
$background-palette: palette.generate-palette(43.19% 0.011 236.92);

‎libs/theme-default/src/date-picker/date-picker.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
.x-datepicker {
1111
@include core.focusable();
12-
@include input-base.input($border-radius);
12+
@include input-base.input($border-radius, $color-variable);
1313

1414
.x-icon {
1515
font-size: 20px;
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
$border-radius: 4px !default;
2+
$color-variable: --datepicker-color !default;

‎libs/theme-default/src/input/input.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@mixin theme() {
66
.x-input {
77
@include core.focusable-within();
8-
@include input-base.input($border-radius);
8+
@include input-base.input($border-radius, $color-variable);
99
@include input-base.error();
1010
}
1111
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
$border-radius: 3px !default;
2+
$color-variable: --input-color !default;

‎libs/theme-default/src/mixins/input-base.scss

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
@use '@xui/theme-core' as core;
22

3-
@mixin input($border-radius) {
3+
@mixin input($border-radius, $color-var) {
44
max-height: 40px;
55
display: flex;
66
gap: 8px;
77
align-items: center;
88
box-sizing: border-box;
9+
background-color: var(#{$color-var});
910

1011
@include core.border-radius($border-radius);
1112

@@ -35,18 +36,20 @@
3536
}
3637

3738
&-light {
38-
background-color: var(--color-bg-secondary);
39+
#{$color-var}: var(--color-background-560);
3940

4041
input {
42+
// TODO
4143
-webkit-text-fill-color: var(--color-bg-secondary-contrast);
4244
caret-color: var(--color-bg-secondary-contrast);
4345
}
4446
}
4547

4648
&-dark {
47-
background-color: var(--color-bg-tertiary);
49+
#{$color-var}: var(--color-background-900);
4850

4951
input {
52+
// TODO
5053
-webkit-text-fill-color: var(--color-bg-tertiary-contrast);
5154
caret-color: var(--color-bg-tertiary-contrast);
5255
}

0 commit comments

Comments
 (0)
Failed to load comments.