From db137f5db3bb908df6fa6bec2e35ac8d61b8c70a Mon Sep 17 00:00:00 2001 From: Victor B <39555268+victorbnl@users.noreply.github.com> Date: Thu, 19 Jan 2023 02:37:18 +0100 Subject: Add custom CSS support (#868) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André Oliveira Co-authored-by: Vijay A --- src/features/appearance/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/features/appearance/index.ts b/src/features/appearance/index.ts index b3cbd3347..9c9f3e175 100644 --- a/src/features/appearance/index.ts +++ b/src/features/appearance/index.ts @@ -2,6 +2,7 @@ import color from 'color'; import { reaction } from 'mobx'; import TopBarProgress from 'react-topbar-progress-indicator'; +import { pathExistsSync, readFileSync } from 'fs-extra'; import { isWindows, isLinux } from '../../environment'; import { DEFAULT_APP_SETTINGS, @@ -10,6 +11,7 @@ import { SIDEBAR_SERVICES_LOCATION_CENTER, SIDEBAR_SERVICES_LOCATION_BOTTOMRIGHT, } from '../../config'; +import { userDataPath } from '../../environment-remote'; const STYLE_ELEMENT_ID = 'custom-appearance-style'; @@ -34,6 +36,11 @@ function darkenAbsolute(originalColor, absoluteChange) { return originalColor.lightness(originalLightness - absoluteChange); } +function generateUserCustomCSS() { + const path = userDataPath('config', 'custom.css'); + return pathExistsSync(path) ? readFileSync(path).toString() : ''; +} + function generateAccentStyle(accentColorStr) { let accentColor; try { @@ -421,6 +428,8 @@ function generateStyle(settings, app) { style += generateOpenWorkspaceStyle(); } + style += generateUserCustomCSS(); + return style; } -- cgit v1.2.3-54-g00ecf