All files / app/codeCharta/state/store/appSettings/mapColors mapColors.reducer.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2775x   75x 75x   75x                             75x     3x 2x    
import { createReducer, on } from "@ngrx/store"
import { MapColors } from "../../../../codeCharta.model"
import { invertColorRange, invertDeltaColors, setMapColors } from "./mapColors.actions"
import { mergeState } from "../../util/setState.reducer.factory"
 
export const defaultMapColors: MapColors = {
    positive: "#69AE40",
    neutral: "#ddcc00",
    negative: "#820E0E",
    selected: "#EB8319",
    positiveDelta: "#64d051",
    negativeDelta: "#ff0E0E",
    base: "#666666",
    flat: "#AAAAAA",
    markingColors: ["#FF1D8E", "#1d8eff", "#1DFFFF", "#8eff1d", "#8e1dff"],
    incomingEdge: "#00ffff",
    outgoingEdge: "#ff00ff",
    labelColorAndAlpha: { rgb: "#e0e0e0", alpha: 0.7 }
}
 
export const mapColors = createReducer(
    defaultMapColors,
    on(setMapColors, mergeState(defaultMapColors)),
    on(invertColorRange, state => ({ ...state, positive: state.negative, negative: state.positive })),
    on(invertDeltaColors, state => ({ ...state, positiveDelta: state.negativeDelta, negativeDelta: state.positiveDelta }))
)