Merge pull request #3512 from weedySeaDragon/bug/3429_er-dark-theme-attribute-colors

fix: ER dark theme attribute colors
This commit is contained in:
Knut Sveidqvist 2022-09-28 13:18:11 +02:00 committed by GitHub
commit e1c63139b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 89 additions and 6 deletions

View File

@ -16,18 +16,30 @@
<body>
<pre class="mermaid">
erDiagram
accTitle: A very simple Entity-Relationship demo
accDescr: Shows the relationships between Customer, Order, Line-Item, and Delivery-Address
title: This is a title
accDescription_ Test a description
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
DELIVERY-ADDRESS {
int customerId
string addressLine1
string addressLine2
string city
string county
string state
string region
string country
string postalCode
}
</pre>
<script type="module">
import mermaid from '../src/mermaid';
mermaid.initialize({
theme: 'forest',
theme: 'base',
// themeCSS: '.node rect { fill: red; }',
logLevel: 3,
securityLevel: 'loose',

View File

@ -6,12 +6,12 @@ const getStyles = (options) =>
}
.attributeBoxOdd {
fill: #ffffff;
fill: ${options.attributeBackgroundColorOdd};
stroke: ${options.nodeBorder};
}
.attributeBoxEven {
fill: #f2f2f2;
fill: ${options.attributeBackgroundColorEven};
stroke: ${options.nodeBorder};
}

View File

@ -0,0 +1,7 @@
/**
* @file Values that have been hardcoded in src/diagrams/er/styles.js. These can be used by
* theme-_._ files to maintain display styles until themes, styles, renderers are revised. --
* 2022-09-22
*/
export const oldAttributeBackgroundColorOdd = '#ffffff';
export const oldAttributeBackgroundColorEven = '#f2f2f2';

View File

@ -1,5 +1,10 @@
import { darken, lighten, adjust, invert } from 'khroma';
import { mkBorder } from './theme-helpers';
import {
oldAttributeBackgroundColorEven,
oldAttributeBackgroundColorOdd,
} from './erDiagram-oldHardcodedValues';
class Theme {
constructor() {
/** # Base variables */
@ -219,6 +224,15 @@ class Theme {
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || '10px';
/* -------------------------------------------------- */
/* EntityRelationship diagrams */
this.attributeBackgroundColorOdd =
this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven =
this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
/* -------------------------------------------------- */
}
calculate(overrides) {
if (typeof overrides !== 'object') {

View File

@ -1,5 +1,6 @@
import { invert, lighten, darken, rgba, adjust } from 'khroma';
import { mkBorder } from './theme-helpers';
class Theme {
constructor() {
this.background = '#333';
@ -28,8 +29,8 @@ class Theme {
this.fontSize = '16px';
this.labelBackground = '#181818';
this.textColor = '#ccc';
/* Flowchart variables */
/* Flowchart variables */
this.nodeBkg = 'calculated';
this.nodeBorder = 'calculated';
this.clusterBkg = 'calculated';
@ -218,6 +219,15 @@ class Theme {
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || '10px';
/* -------------------------------------------------- */
/* EntityRelationship diagrams */
this.attributeBackgroundColorOdd =
this.attributeBackgroundColorOdd || lighten(this.background, 12);
this.attributeBackgroundColorEven =
this.attributeBackgroundColorEven || lighten(this.background, 2);
/* -------------------------------------------------- */
}
calculate(overrides) {
if (typeof overrides !== 'object') {

View File

@ -1,5 +1,9 @@
import { invert, lighten, rgba, adjust, darken } from 'khroma';
import { mkBorder } from './theme-helpers';
import {
oldAttributeBackgroundColorEven,
oldAttributeBackgroundColorOdd,
} from './erDiagram-oldHardcodedValues';
class Theme {
constructor() {
@ -257,6 +261,15 @@ class Theme {
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || '10px';
/* -------------------------------------------------- */
/* EntityRelationship diagrams */
this.attributeBackgroundColorOdd =
this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven =
this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
/* -------------------------------------------------- */
}
calculate(overrides) {
if (typeof overrides !== 'object') {

View File

@ -1,5 +1,10 @@
import { darken, lighten, adjust, invert } from 'khroma';
import { mkBorder } from './theme-helpers';
import {
oldAttributeBackgroundColorEven,
oldAttributeBackgroundColorOdd,
} from './erDiagram-oldHardcodedValues';
class Theme {
constructor() {
/* Base vales */
@ -219,6 +224,15 @@ class Theme {
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || '10px';
/* -------------------------------------------------- */
/* EntityRelationship diagrams */
this.attributeBackgroundColorOdd =
this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven =
this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
/* -------------------------------------------------- */
}
calculate(overrides) {
if (typeof overrides !== 'object') {

View File

@ -1,5 +1,9 @@
import { invert, darken, lighten, adjust } from 'khroma';
import { mkBorder } from './theme-helpers';
import {
oldAttributeBackgroundColorEven,
oldAttributeBackgroundColorOdd,
} from './erDiagram-oldHardcodedValues';
// const Color = require ( 'khroma/dist/color' ).default
// Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => "#EAF2FB"
@ -261,6 +265,15 @@ class Theme {
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || '10px';
/* -------------------------------------------------- */
/* EntityRelationship diagrams */
this.attributeBackgroundColorOdd =
this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven =
this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
/* -------------------------------------------------- */
}
calculate(overrides) {
if (typeof overrides !== 'object') {