From 8bf2fe624d184ef8c3417fef0a06569045a895c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mal=C3=BD?= <michal.maly@ibt.cas.cz> Date: Thu, 20 Apr 2023 17:19:29 +0200 Subject: [PATCH] Add a uniform color theme for NtC tube that still paints the residue and segment dividers in a different color --- CHANGELOG.md | 1 + src/extensions/dnatco/ntc-tube/color.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a27ba48d..aa738a49d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Note that since we don't clearly distinguish between a public and private interf ## [Unreleased] +- Add a uniform color theme for NtC tube that still paints residue and segment dividers in a different color ## [v3.34.0] - 2023-04-16 diff --git a/src/extensions/dnatco/ntc-tube/color.ts b/src/extensions/dnatco/ntc-tube/color.ts index 412069d8f..284caabe1 100644 --- a/src/extensions/dnatco/ntc-tube/color.ts +++ b/src/extensions/dnatco/ntc-tube/color.ts @@ -31,7 +31,8 @@ type NtCTubeColors = typeof NtCTubeColors; export const NtCTubeColorThemeParams = { colors: PD.MappedStatic('default', { 'default': PD.EmptyGroup(), - 'custom': PD.Group(getColorMapParams(NtCTubeColors)) + 'custom': PD.Group(getColorMapParams(NtCTubeColors)), + 'uniform': PD.Color(Color(0xEEEEEE)), }), markResidueBoundaries: PD.Boolean(true), markSegmentBoundaries: PD.Boolean(true), @@ -43,7 +44,15 @@ export function getNtCTubeColorThemeParams(ctx: ThemeDataContext) { } export function NtCTubeColorTheme(ctx: ThemeDataContext, props: PD.Values<NtCTubeColorThemeParams>): ColorTheme<NtCTubeColorThemeParams> { - const colorMap = props.colors.name === 'default' ? NtCTubeColors : props.colors.params; + const colorMap = props.colors.name === 'default' + ? NtCTubeColors + : props.colors.name === 'custom' + ? props.colors.params + : ColorMap({ + ...Object.fromEntries(ObjectKeys(NtCTubeColors).map(item => [item, props.colors.params])), + residueMarker: NtCTubeColors.residueMarker, + stepBoundaryMarker: NtCTubeColors.stepBoundaryMarker + }) as NtCTubeColors; function color(location: Location, isSecondary: boolean): Color { if (NTT.isLocation(location)) { -- GitLab