@grafana/data#getNamedColorPalette TypeScript Examples

The following examples show how to use @grafana/data#getNamedColorPalette. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NamedColorsPalette.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
NamedColorsPalette = ({ color, onChange, theme }: NamedColorsPaletteProps) => {
  const swatches: JSX.Element[] = [];
  getNamedColorPalette().forEach((colors, hue) => {
    swatches.push(
      <NamedColorsGroup
        key={hue}
        theme={theme}
        selectedColor={color}
        colors={colors}
        onColorSelect={color => {
          onChange(color.name);
        }}
      />
    );
  });

  return (
    <div
      style={{
        display: 'grid',
        gridTemplateColumns: 'repeat(3, 1fr)',
        gridRowGap: '24px',
        gridColumnGap: '24px',
      }}
    >
      {swatches}
    </div>
  );
}
Example #2
Source File: ColorPickerPopover.test.tsx    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
allColors = flatten(Array.from(getNamedColorPalette().values()))