Skip to content

Commit f204dab

Browse files
authored
Merge pull request #246 from eccenca/feature/colorPalette-ECC-6637-CMEM-6442
Configure colors via palette & switch to CSS custom properties (ECC-6637 & CMEM-6442)
2 parents b9fd1c0 + 7b568fe commit f204dab

63 files changed

Lines changed: 2122 additions & 563 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deployment-storybook.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ jobs:
2424
- uses: actions/checkout@main
2525
with:
2626
fetch-depth: 0
27+
- name: Workflow git state
28+
run: |
29+
echo github.ref: ${{ github.ref }}
30+
echo github.event_name: ${{ github.event_name }}
31+
echo github.actor: ${{ github.actor }}
32+
git status
33+
git log --oneline -1
2734
- uses: actions/setup-node@main
2835
with:
2936
node-version: "18"
@@ -32,7 +39,7 @@ jobs:
3239
- name: Create jest results
3340
run: yarn test:generate-output
3441
- name: Publish to Chromatic
35-
uses: chromaui/action@v11
42+
uses: chromaui/action@main
3643
with:
3744
token: ${{ secrets.GITHUB_TOKEN }}
3845
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

.storybook/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ module.exports = {
6464
},
6565
webpackFinal: async (config, { configType }) => {
6666
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
67-
67+
if (configType === "PRODUCTION") {
68+
// remove source maps from production storybook
69+
// this may lead to errors when it is created via github workers
70+
// reason is currently not known
71+
config.devtool = false;
72+
}
6873
config.module.rules = [
6974
{
7075
test: /\.(png|jpg|gif|svg)(\\?.*)?$/,

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ This is a major release, and it might be not compatible with your current usage
2121
- component for React Flow v12, displaying new connection lines
2222
- `<VisualTour />`
2323
- component to display a visual tour multi-step tour of the current view
24+
- new color palette that includes 4 sections with 20+ color tints in 5 weights each
25+
- indentity, semantic, layout, extra
26+
- managed via CSS custom properties
27+
- see `README.md` for inf about usage
28+
- SCSS color functions
29+
- `eccgui-color-var`: returns a var of a custom property used for palette color
30+
- `eccgui-color-mix`: mix 2 colors in `srgb`, works with all types of color values and CSS custom properties
31+
- `eccgui-color-rgba`: like `rgba()` but it works also for CSS custom properties
32+
- `colorCalculateDistance()`
33+
- function to calculate the difference between 2 colors using the simple CIE76 formula
34+
- `textToColorHash()`
35+
- function to calculate a color from a text string
2436

2537
### Removed
2638

@@ -37,12 +49,16 @@ This is a major release, and it might be not compatible with your current usage
3749
- support now v9 and v12 of react flow
3850
- `<ReactFlowExtended />`
3951
- use `<EdgeNew />` by default for new connection lines, you can overwrite it by setting `connectionLineComponent` to `undefined`
52+
- overrite the native SCSS `rgba()` function, so it now works for SCSS color values and CSS custom properties
53+
- `getColorConfiguration()` works with CSS custom properties
4054

4155
### Deprecated
4256

4357
- support for React Flow v9 will be removed in v26
4458
- `<EdgeDefs />`
4559
- use `<ReactFlowMarkers />` or build it on single `<ReactFlowMarker />`
60+
- property names returned by `getCOlorConfiguration` were changed to kebab case because they are originally defined via CSS custom properties
61+
- e.g. `graphNode` is now `eccgui-graph-node` and `graphNodeBright` is `eccgui-graph-node-bright`
4662

4763
## [24.4.1] - 2025-08-25
4864

README.md

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,69 @@ yarn add --dev @types/carbon-components-react
2828

2929
### Configuration
3030

31-
All [configuration variables](https://github.com/eccenca/gui-elements/blob/develop/src/configuration/_variables.scss) can be set before importing the full library or the default configuration but for the main changes you should need to change only a few parameters:
32-
33-
- Basic colors
34-
- `$eccgui-color-primary`: color for very important buttons and switches
35-
- `$eccgui-color-primary-contrast`: readable text color used on primary color areas
36-
- `$eccgui-color-accent`: color for most conformation buttons, links, etc
37-
- `$eccgui-color-accent-contrast`: readable text color used on accent color areas
38-
- `$eccgui-color-applicationheader-text`
39-
- `$eccgui-color-applicationheader-background`
40-
- `$eccgui-color-workspace-text`
41-
- `$eccgui-color-workspace-background`
42-
- Basic sizes
43-
- `$eccgui-size-typo-base`: size including absolute unit, currently only `px` is supported
44-
- `$eccgui-size-typo-base-lineheight`: only ratio to font size, no unit!
45-
- `$eccgui-size-type-levelratio`: ratio without unit! used to calculate different text sizes based on `$eccgui-size-typo-base`
46-
- `$eccgui-size-block-whitespace`: white space between block level elements, currently only `px` is supported
31+
All [configuration variables](https://github.com/eccenca/gui-elements/blob/develop/src/configuration/_variables.scss) can be set before importing the full library or the default configuration but for the main properties you should need to change only a few parameters
32+
33+
#### Colors
34+
35+
Since v25 we use a color palette as basic foundation for color configurations. The palette is defined in 4 sections containing various color tints, each tint includes 5 different weights from 100 (light color) to 900 (dark color).
36+
37+
The default palette can be overwritten if it is defined before the configuration or full library is imported to your Sass styles. The palette need to be defined entirely, we currently don't support overwriting it partly.
38+
39+
```
40+
$eccgui-color-palette-light: (
41+
"identity": (
42+
"brand": #fae1cc #f8cd99 #f6b966 #f4a533 #f29100,
43+
"accent": #e5f4fb #aecfe3 #77abca #4186b2 #0a6199,
44+
"text": #f8f8f8 #bcbcbc #818181 #434343 #090909,
45+
"background": #fff #e8e8e8 #d6d6d6 #d4d4d4 #d3d3d3,
46+
),
47+
"semantic": (
48+
"info": #e5f4fb #aecfe3 #77aaca #4086b2 #096199,
49+
"success": #e8f5e9 #b2c6b4 #7c967e #466749 #103713,
50+
"warning": #fff3e0 #fad2b3 #f5b287 #f0915a #eb702d,
51+
"danger": #fff5f6 #edbfc0 #db8989 #c95253 #b71c1c,
52+
),
53+
"layout": (
54+
"yellow": #fff6d5 #f1ecb5 #e3db79 #d4c93c #c1a500,
55+
"purple": #f4ddf3 #c8a2d1 #9d6eb8 #71378f #480e75,
56+
"magenta": #ffd8e8 #f5a6c3 #e276a4 #be4c80 #59122d,
57+
"pink": #fde4f1 #e6b4ce #d08aae #bb5f8e #711c4d,
58+
"violet": #f4e3f4 #d8b0d8 #b377b3 #904490 #570057,
59+
"indigo": #efe4fb #b89ee0 #8f72c5 #6547aa #3b1e8f,
60+
"cyan": #dff9fc #86d6e5 #5abfd4 #2da9c4 #0092b3,
61+
"teal": #d4f2ec #a3ddd3 #6dc0b2 #479d8d #104c42,
62+
"lime": #cde0d6 #bce3c2 #9dcd99 #7ba66c #87b347,
63+
"amber": #ffe7b8 #ffe9c4 #f9cd8d #eeb757 #ef8f00,
64+
"vermilion": #ffd8cc #e4c4ba #b27a6b #8c4b3a #651c09,
65+
"grey": #f5f6f7 #b7b7b7 #808080 #484848 #1c2329,
66+
),
67+
"extra": (
68+
"gold": #fff7d5 #ebd893 #dfc670 #d3b44e #c7a22b,
69+
"silver": #f0f0f0 #dedede #ccc #bababa #a8a8a8,
70+
"bronze": #fbe9db #f2d6bc #eac29d #e1af7e #d89b5f,
71+
),
72+
);
73+
```
74+
75+
All palette colors will be transformed into CSS custom properties automatically and can be referenced by name scheme `--eccgui-color-palette-{groupname}-{colortint}-{colorweight}`, e.g. `--eccgui-color-palette-identity-brand-100`.
76+
77+
All other colors are based on the palette but it is still possible to set them before the default values are used by importing the configuration or the full library.
78+
79+
- `$eccgui-color-primary`: color for very important buttons and switches
80+
- `$eccgui-color-primary-contrast`: readable text color used on primary color areas
81+
- `$eccgui-color-accent`: color for most conformation buttons, links, etc
82+
- `$eccgui-color-accent-contrast`: readable text color used on accent color areas
83+
- `$eccgui-color-applicationheader-text`
84+
- `$eccgui-color-applicationheader-background`
85+
- `$eccgui-color-workspace-text`
86+
- `$eccgui-color-workspace-background`
87+
88+
#### Sizes
89+
90+
- `$eccgui-size-typo-base`: size including absolute unit, currently only `px` is supported
91+
- `$eccgui-size-typo-base-lineheight`: only ratio to font size, no unit!
92+
- `$eccgui-size-type-levelratio`: ratio without unit! used to calculate different text sizes based on `$eccgui-size-typo-base`
93+
- `$eccgui-size-block-whitespace`: white space between block level elements, currently only `px` is supported
4794

4895
## Development
4996

@@ -125,7 +172,7 @@ After you tested the GUI elements package locally you can Clean up your applicat
125172
3. Pull request from release branch into `main` need to be approved
126173
- then ["Publish: final release "](https://github.com/eccenca/gui-elements/actions/workflows/publish-final-release.yml) can be used on `main` (or `next` and `legacy`) to publish final release packages
127174
- another PR is automatically created for changes done during publishing process
128-
175+
129176
## License
130177

131178
Apache License, Version 2.0, January 2004

src/_shame.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ textarea:focus-visible {
5151
}
5252

5353
:focus-visible {
54-
outline: rgba($eccgui-color-accent, $eccgui-opacity-muted) solid 2px;
54+
outline: eccgui-color-rgba($eccgui-color-accent, $eccgui-opacity-muted) solid 2px;
5555
outline-offset: 1px;
5656
}

src/cmem/markdown/Markdown.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from "react";
2-
import { Blockquote } from "@blueprintjs/core";
32
import { Meta, StoryFn } from "@storybook/react";
43

54
import { Markdown } from "./../../../index";

0 commit comments

Comments
 (0)