Skip to content

Commit

Permalink
feat(Color palettes and design updates):
Browse files Browse the repository at this point in the history
  • Loading branch information
theiliad committed May 9, 2019
1 parent aee454a commit 9f6fde8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
7 changes: 5 additions & 2 deletions packages/core/demo/demo-data/colors.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { themes, defaultColors } from "../../src/index";
import { colorPalettes } from "../../src/index";

const urlParams = new URLSearchParams(window.location.search);

// Grab "theme" param from query string
let themeToUse = urlParams.has("theme") ? themes[urlParams.get("theme")] : defaultColors;
let themeToUse = colorPalettes.DEFAULT;
if (urlParams.has("theme") && colorPalettes[urlParams.get("theme")]) {
themeToUse = colorPalettes[urlParams.get("theme")];
}

export const colors = themeToUse;
2 changes: 1 addition & 1 deletion packages/core/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h3>A reusable framework-agnostic D3 charting library.</h3>
</li>
<li>
<ul class="bx--dropdown-list">
<li data-option data-value="LIGHT_1" class="bx--dropdown-item">
<li data-option data-value="DEFAULT" class="bx--dropdown-item">
<a class="bx--dropdown-link" href="#" tabindex="-1">Light UI - Primary</a>
</li>
<li data-option data-value="LIGHT_2" class="bx--dropdown-item">
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ScaleBand, ScaleLinear } from "d3-scale";
import { Tools } from "./tools";
import * as themes from "./services/themes";
import * as colorPalettes from "./services/colorPalettes";

/*
**********************
Expand Down Expand Up @@ -139,7 +139,7 @@ export interface BaseChartOptions {
const baseOptions: BaseChartOptions = {
legendClickable: true,
containerResizable: true,
colors: themes.LIGHT_1,
colors: colorPalettes.DEFAULT,
tooltip: {
size: TooltipSize.FULL,
formatter: null,
Expand Down
11 changes: 4 additions & 7 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ import { LineChart } from "./line-chart";
import { ComboChart } from "./combo-chart";
import { ScatterChart } from "./scatter-chart";

import colors from "./services/colors";
import * as Configuration from "./configuration";
const defaultColors = Configuration.options.BASE.colors;

import * as themes from "./services/themes";
import * as colorPalettes from "./services/colorPalettes";
// TODO 1.0 - Remove deprecated API
const defaultColors = colorPalettes.DEFAULT;

export {
colors,
defaultColors,
themes,
colorPalettes,
BaseChart,
BaseAxisChart,
PieChart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ export const DARK_1 = [
colors.teal(60),
colors.magenta(30)
];

export const DEFAULT = LIGHT_1;

0 comments on commit 9f6fde8

Please sign in to comment.