Skip to content

Commit

Permalink
#7517 make unique highlighter work when using dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
piorek committed Jun 14, 2018
1 parent 753caf2 commit 11074ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 8 additions & 0 deletions js/notebook/src/BeakerXThemeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export default class BeakerXThemeHelper {
return this.isDark ? 'rgb(26, 26, 26)' : 'rgb(249, 249, 249)';
}

public static get MIN_LIGHTNESS_VALUE(): number {
return this.isDark ? 15 : 35;
}

public static get MIN_SATURATION_VALUE(): number {
return this.isDark ? 15 : 35;
}

private static getDarkStyle(): DataGrid.IStyle {
return {
...DataGrid.defaultStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import BeakerXThemeHelper from "../../../BeakerXThemeHelper";

const MAX_HUE_VALUE = 360;
const DEFAULT_HSL_COMPONENT_STEPS_COUNT = 50;
const MIN_SATURATION_VALUE = 35;
const MIN_LIGHTNESS_VALUE = 35;

export default class UniqueEntriesHighlighter extends Highlighter {
uniqueValues: any[] = [];
Expand Down Expand Up @@ -95,8 +93,8 @@ export default class UniqueEntriesHighlighter extends Highlighter {
lightnessStepCount += 1;
}

let saturation = MIN_SATURATION_VALUE + saturationRatio * DEFAULT_HSL_COMPONENT_STEPS_COUNT;
let lightness = MIN_LIGHTNESS_VALUE + lightnessRatio * DEFAULT_HSL_COMPONENT_STEPS_COUNT;
let saturation = BeakerXThemeHelper.MIN_SATURATION_VALUE + saturationRatio * DEFAULT_HSL_COMPONENT_STEPS_COUNT;
let lightness = BeakerXThemeHelper.MIN_LIGHTNESS_VALUE + lightnessRatio * DEFAULT_HSL_COMPONENT_STEPS_COUNT;

return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
}
Expand Down

0 comments on commit 11074ba

Please sign in to comment.