/** * Created by michaelbessey on 10/22/16. */ import {ChartDrawArea} from "./chart_area"; export function colorThemeGenerator0(){ const blue = "#232E53", orange = "#DF6035", green = "#42A44C", yellow = "#EFB83B", purple = "#855AA1", teal = "#69A5AC", red = "#D7313E", blue1 = "#318FBF", blueLight = "#5F6781", orangeLight = "#E78B6C", greenLight = "#75BC7C", yellowLight = "#F3CB70", purpleLight = "#A687BA", tealLight = "#94BFC2", redLight = "#E16972", blueLight1 = "#69ADD0", gray0 = "#E8E8E7", gray1 = "#ACABA8", gray2 = "#555555" ; return { colorDefault: blue, colorSequentialHigh: blue, colorSequentialMid: gray1, colorSequentialLow: orange, colorPaletteQual: [blue, orange, green, yellow, purple, teal, red, blue1], colorPaletteSemanticPositive: [green, green, green, greenLight, greenLight, greenLight], colorPaletteSemanticNegative: [red, red, red, redLight, redLight, redLight], colorPaletteSemanticCaution: [yellow, yellow, yellow, yellowLight, yellowLight, yellowLight], colorPaletteSemanticNeutral: [gray2, gray2, gray1, gray1, gray0, gray0], colorPaletteSequentialBrandBlue: [blue, blue, blue, blueLight, blueLight, blueLight], colorPaletteSequentialPurple: [purple, purple, purple, purpleLight, purpleLight, purpleLight], colorPaletteSequentialGreen: [green, green, green, greenLight, greenLight, greenLight], colorPaletteSequentialOrange: [orange, orange, orange, orangeLight, orangeLight, orangeLight], colorPaletteSequentialGray: [gray2, gray2, gray1, gray1, gray0, gray0], // @deprecated color variables support colorDark: blue, colorLight: blueLight, colorSequentialDarkHigh: blue, colorSequentialDarkLow: orange, colorSequentialLightHigh: blueLight, colorSequentialLightLow: orangeLight, colorPaletteQualDark: [blue, orange, green, yellow, purple, teal, red, blue1], colorPaletteQualLight: [blueLight, orangeLight, greenLight, yellowLight, purpleLight, tealLight, redLight, blueLight1], colorNeutralLight: gray0, colorNeutralMedium: gray1, colorNeutralDark: gray2 }; } export function colorThemeGenerator1(){ const blue = "#002F6C", orange = "#FF671F", green = "#43B02A", yellow = "#F6BE00", purple = "#8658A3", teal = "#6AA7AD", red = "#EE2737", blue1 = "#009CDE", blueLight = "#4C6D98", orangeLight = "#F69460", greenLight = "#78C580", yellowLight = "#FAD15B", purpleLight = "#AA8ABE", tealLight = "#94C0C5", redLight = "#F86F77", blueLight1 = "#5FB7E2", gray0 = "#E8E8E7", gray1 = "#ACABA8", gray2 = "#555555" ; return { colorDefault: blue, colorSequentialHigh: blue, colorSequentialMid: gray1, colorSequentialLow: orange, colorPaletteQual: [blue, orange, green, yellow, purple, teal, red, blue1], colorPaletteSemanticPositive: [green, green, green, greenLight, greenLight, greenLight], colorPaletteSemanticNegative: [red, red, red, redLight, redLight, redLight], colorPaletteSemanticCaution: [yellow, yellow, yellow, yellowLight, yellowLight, yellowLight], colorPaletteSemanticNeutral: [gray2, gray2, gray1, gray1, gray0, gray0], colorPaletteSequentialBrandBlue: [blue, blue, blueLight, blueLight, blueLight1, blueLight1], colorPaletteSequentialPurple: [purple, purple, purple, purpleLight, purpleLight, purpleLight], colorPaletteSequentialGreen: [green, green, green, greenLight, greenLight, greenLight], colorPaletteSequentialOrange: [orange, orange, orange, orangeLight, orangeLight, orangeLight], colorPaletteSequentialGray: [gray2, gray2, gray1, gray1, gray0, gray0], // @deprecated color variables support colorDark: blue, colorLight: blueLight, colorSequentialDarkHigh: blue, colorSequentialDarkLow: orange, colorSequentialLightHigh: blueLight, colorSequentialLightLow: orangeLight, colorPaletteQualDark: [blue, orange, green, yellow, purple, teal, red, blue1], colorPaletteQualLight: [blueLight, orangeLight, greenLight, yellowLight, purpleLight, tealLight, redLight, blueLight1], colorNeutralLight: gray0, colorNeutralMedium: gray1, colorNeutralDark: gray2 }; } export function colorThemeGenerator2(){ const // Divergent Colors mmDivStart = "#FF671F", mmDivMiddle = "#D9D9D6", mmDivEnd = "#009CDE", // Semantic Colors mmSemPos90 = "#02422E", mmSemPos80 = "#026346", mmSemPos60 = "#059469", mmSemPos50 = "#06C58C", mmSemPos40 = "#72DDA7", mmSemPos20 = "#A8F0C0", mmSemNeg90 = "#5B081D", mmSemNeg80 = "#990E31", mmSemNeg60 = "#EB2254", mmSemNeg50 = "#F16084", mmSemNeg40 = "#F69FB4", mmSemNeg20 = "#FBCDD9", mmSemCaution90 = "#9F710D", mmSemCaution80 = "#CF940D", mmSemCaution60 = "#EFB022", mmSemCaution50 = "#F2C151", mmSemCaution40 = "#F6D281", mmSemCaution20 = "#F9E3B1", mmSemNeutral80 = "#555555", mmSemNeutral60 = "#888888", mmSemNeutral50 = "#A1A1A1", mmSemNeutral40 = "#BABABA", mmSemNeutral30 = "#D9D9D6", mmSemNeutral10 = "#EEEEED", // Qualitative Colors mmQualHue01 = "#002F6C", mmQualHue02 = "#4CC8EB", mmQualHue03 = "#E838A9", mmQualHue04 = "#77BE0C", mmQualHue05 = "#EFB022", mmQualHue06 = "#EB2254", mmQualHue07 = "#802AB8", mmQualHue08 = "#059469", mmQualHue09 = "#FF671F", mmQualHue10 = "#009CDE", // Sequential Colors mmSeqBrandBlue90 = "#002F6C", mmSeqBrandBlue80 = "#004DB0", mmSeqBrandBlue60 = "#0B70F4", mmSeqBrandBlue50 = "#398FFF", mmSeqBrandBlue40 = "#9FC9FF", mmSeqBrandBlue20 = "#D2E5FF", mmSeqPurple90 = "#3D1457", mmSeqPurple80 = "#5A1D81", mmSeqPurple60 = "#802AB8", mmSeqPurple50 = "#A95CDA", mmSeqPurple40 = "#CDA2EA", mmSeqPurple20 = "#E4CCF3", mmSeqGreen90 = "#02422E", mmSeqGreen80 = "#026346", mmSeqGreen60 = "#059469", mmSeqGreen50 = "#06C58C", mmSeqGreen40 = "#72DDA7", mmSeqGreen20 = "#A8F0C0", mmSeqOrange90 = "#852B01", mmSeqOrange80 = "#B83B00", mmSeqOrange60 = "#FF671F", mmSeqOrange50 = "#FF9563", mmSeqOrange40 = "#FFB896", mmSeqOrange20 = "#FFDAC9", mmSeqGray80 = "#555555", mmSeqGray60 = "#888888", mmSeqGray50 = "#A1A1A1", mmSeqGray40 = "#BABABA", mmSeqGray30 = "#D9D9D6", mmSeqGray10 = "#EEEEED" ; return { colorDefault: mmQualHue01, colorSequentialHigh: mmDivEnd, colorSequentialMid: mmDivMiddle, colorSequentialLow: mmDivStart, colorPaletteQual: [mmQualHue01, mmQualHue02, mmQualHue03, mmQualHue04, mmQualHue05, mmQualHue06, mmQualHue07, mmQualHue08, mmQualHue09, mmQualHue10], colorPaletteSemanticPositive: [mmSemPos90, mmSemPos80, mmSemPos60, mmSemPos50, mmSemPos40, mmSemPos20], colorPaletteSemanticNegative: [mmSemNeg90, mmSemNeg80, mmSemNeg60, mmSemNeg50, mmSemNeg40, mmSemNeg20], colorPaletteSemanticCaution: [mmSemCaution90, mmSemCaution80, mmSemCaution60, mmSemCaution50, mmSemCaution40, mmSemCaution20], colorPaletteSemanticNeutral: [mmSemNeutral80, mmSemNeutral60, mmSemNeutral50, mmSemNeutral40, mmSemNeutral30, mmSemNeutral10], colorPaletteSequentialBrandBlue: [mmSeqBrandBlue90, mmSeqBrandBlue80, mmSeqBrandBlue60, mmSeqBrandBlue50, mmSeqBrandBlue40, mmSeqBrandBlue20], colorPaletteSequentialPurple: [mmSeqPurple90, mmSeqPurple80, mmSeqPurple60, mmSeqPurple50, mmSeqPurple40, mmSeqPurple20], colorPaletteSequentialGreen: [mmSeqGreen90, mmSeqGreen80, mmSeqGreen60, mmSeqGreen50, mmSeqGreen40, mmSeqGreen20], colorPaletteSequentialOrange: [mmSeqOrange90, mmSeqOrange80, mmSeqOrange60, mmSeqOrange50, mmSeqOrange40, mmSeqOrange20], colorPaletteSequentialGray: [mmSeqGray80, mmSeqGray60, mmSeqGray50, mmSeqGray40, mmSeqGray30, mmSeqGray10], // @deprecated color variables support colorDark: mmSeqBrandBlue90, colorLight: mmSeqBrandBlue60, colorSequentialDarkHigh: mmSeqBrandBlue60, colorSequentialDarkLow: mmSeqOrange60, colorSequentialLightHigh: mmSeqBrandBlue40, colorSequentialLightLow: mmSeqOrange40, colorPaletteQualDark: [mmSeqBrandBlue90, mmSeqOrange60, mmSemPos60, mmSemCaution60, mmSeqPurple60, mmSemNeutral60, mmSemNeg60, mmSeqBrandBlue60], colorPaletteQualLight: [mmSeqBrandBlue60, mmSeqOrange40, mmSemPos40, mmSemCaution40, mmSeqPurple40, mmSemNeutral40, mmSemNeg40, mmSeqBrandBlue40], colorNeutralLight: mmSeqGray30, colorNeutralMedium: mmSeqGray50, colorNeutralDark: mmSeqGray80 }; } export function colorThemeGenerator3(){ const // Divergent Colors mmDivStart = "#FF671F", mmDivMiddle = "#D9D9D6", mmDivEnd = "#009CDE", // Semantic Colors mmSemPos90 = "#02422E", mmSemPos80 = "#026346", mmSemPos60 = "#059469", mmSemPos50 = "#06C58C", mmSemPos40 = "#72DDA7", mmSemPos20 = "#A8F0C0", mmSemNeg90 = "#5B081D", mmSemNeg80 = "#990E31", mmSemNeg60 = "#EB2254", mmSemNeg50 = "#F16084", mmSemNeg40 = "#F69FB4", mmSemNeg20 = "#FBCDD9", mmSemCaution90 = "#9F710D", mmSemCaution80 = "#CF940D", mmSemCaution60 = "#EFB022", mmSemCaution50 = "#F2C151", mmSemCaution40 = "#F6D281", mmSemCaution20 = "#F9E3B1", mmSemNeutral80 = "#555555", mmSemNeutral60 = "#888888", mmSemNeutral50 = "#A1A1A1", mmSemNeutral40 = "#BABABA", mmSemNeutral30 = "#D9D9D6", mmSemNeutral10 = "#EEEEED", // Qualitative Colors mmQualHue01 = "#2180C0", mmQualHue02 = "#CB6F0F", mmQualHue03 = "#B751FF", mmQualHue04 = "#4CC8EB", mmQualHue05 = "#E5C494", mmQualHue06 = "#898DFF", mmQualHue07 = "#FB9A99", mmQualHue08 = "#0091FF", mmQualHue09 = "#8C8669", mmQualHue10 = "#FF671F", mmQualHue11 = "#77BE0C", mmQualHue12 = "#E8B11D", // Sequential Colors mmSeqBrandBlue90 = "#002F6C", mmSeqBrandBlue80 = "#004DB0", mmSeqBrandBlue60 = "#0B70F4", mmSeqBrandBlue50 = "#398FFF", mmSeqBrandBlue40 = "#9FC9FF", mmSeqBrandBlue20 = "#D2E5FF", mmSeqPurple90 = "#3D1457", mmSeqPurple80 = "#5A1D81", mmSeqPurple60 = "#802AB8", mmSeqPurple50 = "#A95CDA", mmSeqPurple40 = "#CDA2EA", mmSeqPurple20 = "#E4CCF3", mmSeqGreen90 = "#02422E", mmSeqGreen80 = "#026346", mmSeqGreen60 = "#059469", mmSeqGreen50 = "#06C58C", mmSeqGreen40 = "#72DDA7", mmSeqGreen20 = "#A8F0C0", mmSeqOrange90 = "#852B01", mmSeqOrange80 = "#B83B00", mmSeqOrange60 = "#FF671F", mmSeqOrange50 = "#FF9563", mmSeqOrange40 = "#FFB896", mmSeqOrange20 = "#FFDAC9", mmSeqGray80 = "#555555", mmSeqGray60 = "#888888", mmSeqGray50 = "#A1A1A1", mmSeqGray40 = "#BABABA", mmSeqGray30 = "#D9D9D6", mmSeqGray10 = "#EEEEED" ; return { colorDefault: mmQualHue01, colorSequentialHigh: mmDivEnd, colorSequentialMid: mmDivMiddle, colorSequentialLow: mmDivStart, colorPaletteQual: [mmQualHue01, mmQualHue02, mmQualHue03, mmQualHue04, mmQualHue05, mmQualHue06, mmQualHue07, mmQualHue08, mmQualHue09, mmQualHue10, mmQualHue11, mmQualHue12], colorPaletteSemanticPositive: [mmSemPos90, mmSemPos80, mmSemPos60, mmSemPos50, mmSemPos40, mmSemPos20], colorPaletteSemanticNegative: [mmSemNeg90, mmSemNeg80, mmSemNeg60, mmSemNeg50, mmSemNeg40, mmSemNeg20], colorPaletteSemanticCaution: [mmSemCaution90, mmSemCaution80, mmSemCaution60, mmSemCaution50, mmSemCaution40, mmSemCaution20], colorPaletteSemanticNeutral: [mmSemNeutral80, mmSemNeutral60, mmSemNeutral50, mmSemNeutral40, mmSemNeutral30, mmSemNeutral10], colorPaletteSequentialBrandBlue: [mmSeqBrandBlue90, mmSeqBrandBlue80, mmSeqBrandBlue60, mmSeqBrandBlue50, mmSeqBrandBlue40, mmSeqBrandBlue20], colorPaletteSequentialPurple: [mmSeqPurple90, mmSeqPurple80, mmSeqPurple60, mmSeqPurple50, mmSeqPurple40, mmSeqPurple20], colorPaletteSequentialGreen: [mmSeqGreen90, mmSeqGreen80, mmSeqGreen60, mmSeqGreen50, mmSeqGreen40, mmSeqGreen20], colorPaletteSequentialOrange: [mmSeqOrange90, mmSeqOrange80, mmSeqOrange60, mmSeqOrange50, mmSeqOrange40, mmSeqOrange20], colorPaletteSequentialGray: [mmSeqGray80, mmSeqGray60, mmSeqGray50, mmSeqGray40, mmSeqGray30, mmSeqGray10], // @deprecated color variables support colorDark: mmSeqBrandBlue90, colorLight: mmSeqBrandBlue60, colorSequentialDarkHigh: mmSeqBrandBlue60, colorSequentialDarkLow: mmSeqOrange60, colorSequentialLightHigh: mmSeqBrandBlue40, colorSequentialLightLow: mmSeqOrange40, colorPaletteQualDark: [mmSeqBrandBlue90, mmSeqOrange60, mmSemPos60, mmSemCaution60, mmSeqPurple60, mmSemNeutral60, mmSemNeg60, mmSeqBrandBlue60], colorPaletteQualLight: [mmSeqBrandBlue60, mmSeqOrange40, mmSemPos40, mmSemCaution40, mmSeqPurple40, mmSemNeutral40, mmSemNeg40, mmSeqBrandBlue40], colorNeutralLight: mmSeqGray30, colorNeutralMedium: mmSeqGray50, colorNeutralDark: mmSeqGray80 }; } export class Theme { public static getInstance(): Theme { return Theme._instance; } private static _instance: Theme = new Theme(); miniWidth: number; colors: any; // @deprecated color variables colorLight: string; colorDark: string; colorNeutralLight: string; colorNeutralMedium: string; colorNeutralDark: string; colorSequentialLightHigh: string; colorSequentialLightLow: string; colorSequentialDarkHigh: string; colorSequentialDarkLow: string; colorPaletteQualLight; colorPaletteQualDark; minLineWidth: number; maxLineWidth: number; linePercentage: number; minArea: number; maxArea: number; areaPercentage: number; areaPercentageRange: number[]; textAxisLabelSize: number; shapes; constructor(){ this.miniWidth = 500; this.minLineWidth = 1; this.maxLineWidth = 5; this.linePercentage = 0.00002; this.minArea = 50; this.maxArea = 500; this.areaPercentage = 0.0002; this.textAxisLabelSize = 14; this.colors = colorThemeGenerator1(); this.shapes = ["circle", "rect", "triangle"]; // @deprecated color attributes this.colorLight = this.colors.colorLight; this.colorDark = this.colors.colorDark; this.colorNeutralLight = this.colors.colorNeutralLight; this.colorNeutralMedium = this.colors.colorNeutralMedium; this.colorNeutralDark = this.colors.colorNeutralDark; this.colorSequentialLightHigh = this.colors.colorSequentialLightHigh; this.colorSequentialLightLow = this.colors.colorSequentialLightLow; this.colorSequentialDarkHigh = this.colors.colorSequentialDarkHigh; this.colorSequentialDarkLow = this.colors.colorSequentialDarkLow; this.colorPaletteQualLight = this.colors.colorPaletteQualLight; this.colorPaletteQualDark = this.colors.colorPaletteQualDark; } getAreaRange(drawArea: ChartDrawArea){ return [this.minArea, this.maxArea]; } getArea(drawArea: ChartDrawArea){ let area = this.areaPercentage * drawArea.area; area = (area < this.minArea) ? this.minArea : area; area = (area > this.maxArea) ? this.maxArea : area; return area; } getLineWidth(drawArea: ChartDrawArea){ let lineWidth = this.linePercentage * drawArea.area; lineWidth = (lineWidth < this.minLineWidth) ? this.minLineWidth : lineWidth; lineWidth = (lineWidth > this.maxLineWidth) ? this.maxLineWidth : lineWidth; return lineWidth; } }