From b8c21c2adef84477abd5c910c2182da292106f7b Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 21 Jan 2024 20:20:00 +0100 Subject: [PATCH] fix(labels): text and background combination in dark mode --- src/models/label.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/models/label.ts b/src/models/label.ts index d86c1822a..04bc9b35a 100644 --- a/src/models/label.ts +++ b/src/models/label.ts @@ -27,7 +27,17 @@ export default class LabelModel extends AbstractModel implements ILabel if (this.hexColor !== '' && this.hexColor.substring(0, 1) !== '#') { this.hexColor = '#' + this.hexColor } - this.textColor = colorIsDark(this.hexColor) ? '#4a4a4a' : '#fff' + + if (this.hexColor === '') { + this.hexColor = 'var(--grey-200)' + this.textColor = 'var(--grey-800)' + } else { + this.textColor = colorIsDark(this.hexColor) + // Fixed colors to avoid flipping in dark mode + ? 'hsl(215, 27.9%, 16.9%)' // grey-800 + : 'hsl(220, 13%, 91%)' // grey-200 + } + this.createdBy = new UserModel(this.createdBy) this.created = new Date(this.created)