diff options
-rw-r--r-- | src/Utils.ts | 2 | ||||
-rw-r--r-- | src/client/views/StyleProvider.tsx | 17 | ||||
-rw-r--r-- | src/client/views/nodes/button/FontIconBox.tsx | 2 |
3 files changed, 10 insertions, 11 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index e11f1154e..db33875ea 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -576,7 +576,7 @@ export function simulateMouseClick(element: Element | null | undefined, x: numbe export function lightOrDark(color: any) { const nonAlphaColor = color.startsWith("#") ? (color as string).substring(0, 7) : color.startsWith("rgba") ? color.replace(/,.[^,]*\)/, ")").replace("rgba", "rgb") : color; - const col = Color(nonAlphaColor).rgb(); + const col = Color(nonAlphaColor.toLowerCase()).rgb(); const colsum = (col.red() + col.green() + col.blue()); if (colsum / col.alpha() > 400 || col.alpha() < 0.25) return Colors.DARK_GRAY; else return Colors.WHITE; diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index 1eb7a222e..507c3d2b2 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -1,28 +1,27 @@ -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Colors } from './global/globalEnums'; import { IconProp } from '@fortawesome/fontawesome-svg-core'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import 'golden-layout/src/css/goldenlayout-base.css'; import 'golden-layout/src/css/goldenlayout-dark-theme.css'; -import { runInAction, action } from 'mobx'; +import { action, runInAction } from 'mobx'; import { Doc, Opt, StrListCast } from "../../fields/Doc"; import { List } from '../../fields/List'; import { listSpec } from '../../fields/Schema'; import { BoolCast, Cast, NumCast, StrCast } from "../../fields/Types"; +import { lightOrDark } from '../../Utils'; import { DocumentType } from '../documents/DocumentTypes'; import { CurrentUserUtils } from '../util/CurrentUserUtils'; +import { ColorScheme } from '../util/SettingsManager'; import { SnappingManager } from '../util/SnappingManager'; -import { UndoManager, undoBatch } from '../util/UndoManager'; +import { undoBatch, UndoManager } from '../util/UndoManager'; import { CollectionViewType } from './collections/CollectionView'; -import "./collections/TreeView.scss"; +import { Colors } from './global/globalEnums'; import { MainView } from './MainView'; import { DocumentViewProps } from "./nodes/DocumentView"; import { FieldViewProps } from './nodes/FieldView'; -import "./nodes/FilterBox.scss"; +import { SliderBox } from './nodes/SliderBox'; import "./StyleProvider.scss"; import React = require("react"); import Color = require('color'); -import { lightOrDark } from '../../Utils'; -import { ColorScheme } from '../util/SettingsManager'; export enum StyleLayers { Background = "background" @@ -136,7 +135,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<DocumentViewProps case DocumentType.SCREENSHOT: case DocumentType.VID: docColor = docColor || (darkScheme() ? Colors.DARK_GRAY : Colors.LIGHT_GRAY); break; case DocumentType.COL: - if (StrCast(Doc.LayoutField(doc)).includes("SliderBox")) break; + if (StrCast(Doc.LayoutField(doc)).includes(SliderBox.name)) break; docColor = docColor || (doc?._isGroup ? "#00000004" : // very faint highlight to show bounds of group (doc?._viewType === CollectionViewType.Pile || Doc.IsSystem(doc) ? (darkScheme() ? Colors.DARK_GRAY : Colors.LIGHT_GRAY) : // system docs (seen in treeView) get a grayish background diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx index af4a581f1..f975b063a 100644 --- a/src/client/views/nodes/button/FontIconBox.tsx +++ b/src/client/views/nodes/button/FontIconBox.tsx @@ -335,7 +335,7 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon return <SketchPicker onChange={change} color={curColor} - presetColors={presets} /> + presetColors={presets} />; } /** * Color button |