Skip to content

Commit 4b8eeaa

Browse files
committed
extract color constants to css
1 parent 3e76258 commit 4b8eeaa

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/features/constraintMenu/commands.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ChooseConstraintCommand extends Command {
3131
const nodes = context.root.children.filter((node) => getBasicType(node) === "node") as DfdNodeImpl[];
3232
if (names.length === 0) {
3333
nodes.forEach((node) => {
34-
node.setColor("#1D1C22");
34+
node.setColor("var(--color-primary)");
3535
});
3636
return context.root;
3737
}
@@ -56,14 +56,14 @@ export class ChooseConstraintCommand extends Command {
5656
}
5757
});
5858
});
59-
if (!wasAdjusted) node.setColor("#1D1C22");
59+
if (!wasAdjusted) node.setColor("var(--color-primary)");
6060
});
6161

6262
nodes.forEach((node) => {
6363
const inTFG = node.annotations!.filter((annotation) =>
6464
this.annnotationsManager.getSelectedTfgs().has(annotation.tfg!),
6565
);
66-
if (inTFG.length > 0) node.setColor("#77777A", false);
66+
if (inTFG.length > 0) node.setColor("var(--color-highlighted)", false);
6767
});
6868

6969
return context.root;

src/features/dfdElements/elementStyles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/* Background fill of the node.
2020
When --color is unset this is just --color-primary.
2121
If this node is annotated and --color is set, it will be included in the color mix. */
22-
fill: color-mix(in srgb, var(--color-primary), var(--color, transparent) 25%);
22+
fill: color-mix(in srgb, var(--color-primary), var(--color, transparent) 40%);
2323
}
2424

2525
.sprotty-node .node-label text {

src/features/dfdElements/nodes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export abstract class DfdNodeImpl extends DynamicChildrenNode implements WithEdi
3939
static readonly DEFAULT_FEATURES = [...SNodeImpl.DEFAULT_FEATURES, withEditLabelFeature, containsDfdLabelFeature];
4040
static readonly DEFAULT_WIDTH = 50;
4141
static readonly WIDTH_PADDING = 12;
42-
static readonly NODE_COLOR = "#1D1C22";
43-
static readonly HIGHLIGHTED_COLOR = "#77777A";
42+
static readonly NODE_COLOR = "var(--color-primary)";
43+
static readonly HIGHLIGHTED_COLOR = "var(--color-highlighted)";
4444

4545
text: string = "";
4646
color?: string;

src/theme.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
--color-spacer: #e5e5e5;
66
--color-error: #f00;
77
--color-valid: #00b600;
8+
--color-highlighted: #77777a;
89
--color-tool-palette-hover: #ccc;
910
--color-tool-palette-selected: #bbb;
1011
--dark-mode: 0;

0 commit comments

Comments
 (0)