How to use the tinycolor2.random function in tinycolor2

To help you get started, we’ve selected a few tinycolor2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thingsboard / thingsboard / ui / src / app / components / datasource-device.directive.js View on Github external
scope.showColorPicker = function (event, dataKey) {
            $mdColorPicker.show({
                value: dataKey.color,
                defaultValue: '#fff',
                random: tinycolor.random(),
                clickOutsideToClose: false,
                hasBackdrop: false,
                skipHide: true,
                preserveScope: false,

                mdColorAlphaChannel: true,
                mdColorSpectrum: true,
                mdColorSliders: true,
                mdColorGenericPalette: false,
                mdColorMaterialPalette: true,
                mdColorHistory: false,
                mdColorDefaultTab: 2,

                $event: event

            }).then(function (color) {
github thingsboard / thingsboard / ui / src / app / components / datasource-entity.directive.js View on Github external
scope.showColorPicker = function (event, dataKey) {
            $mdColorPicker.show({
                value: dataKey.color,
                defaultValue: '#fff',
                random: tinycolor.random(),
                clickOutsideToClose: false,
                hasBackdrop: false,
                multiple: true,
                preserveScope: false,

                mdColorAlphaChannel: true,
                mdColorSpectrum: true,
                mdColorSliders: true,
                mdColorGenericPalette: false,
                mdColorMaterialPalette: true,
                mdColorHistory: false,
                mdColorDefaultTab: 2,

                $event: event

            }).then(function (color) {
github mozilla / FirefoxColor / src / lib / generators.js View on Github external
export const generateComplementaryTheme = (color = null) => {
  const newTheme = cloneDefault();
  const seed = color === null ? tinycolor.random() : tinycolor(color);
  const baseColor = seed.toRgb();
  const lightColor = seed.lighten(5).toRgb();
  const complementColor = createA11yColor(seed.complement().toRgb(), baseColor);

  newTheme.colors.toolbar = baseColor;
  newTheme.colors.toolbar_text = complementColor;
  newTheme.colors.frame = lightColor;
  newTheme.colors.tab_background_text = complementColor;
  newTheme.colors.toolbar_field = lightColor;
  newTheme.colors.toolbar_field_text = complementColor;
  newTheme.colors.tab_line = complementColor;
  newTheme.colors.popup = lightColor;
  newTheme.colors.popup_text = complementColor;

  return normalizeTheme(newTheme);
};
github johnpapa / vscode-peacock / src / color-library.ts View on Github external
export function getRandomColorHex() {
  return formatHex(tinycolor.random());
}
github thingsboard / thingsboard / ui / src / app / components / json-form.directive.js View on Github external
scope.showColorPicker = function (event, color) {
            $mdColorPicker.show({
                value: tinycolor(color).toRgbString(),
                defaultValue: '#fff',
                random: tinycolor.random(),
                clickOutsideToClose: false,
                hasBackdrop: false,
                multiple: true,
                preserveScope: false,

                mdColorAlphaChannel: true,
                mdColorSpectrum: true,
                mdColorSliders: true,
                mdColorGenericPalette: false,
                mdColorMaterialPalette: true,
                mdColorHistory: false,
                mdColorDefaultTab: 2,

                $event: event

            }).then(function (color) {
github intuit / auto / packages / core / src / git.ts View on Github external
async createLabel(name: string, label: ILabelDefinition) {
    this.logger.verbose.info(`Creating "${name}" label :\n${label.name}`);

    const color = label.color
      ? tinyColor(label.color).toString('hex6')
      : tinyColor.random().toString('hex6');
    const result = await this.github.issues.createLabel({
      name: label.name,
      owner: this.options.owner,
      repo: this.options.repo,
      color: color.replace('#', ''),
      description: label.description
    });

    this.logger.veryVerbose.info('Got response from createLabel\n', result);
    this.logger.verbose.info('Created label on GitHub.');

    return result;
  }
github mozilla / FirefoxColor / src / lib / generators.js View on Github external
Object.keys(newTheme.colors).map(key => {
    newTheme.colors[key] = tinycolor.random().toRgb();
  });
github thingsboard / thingsboard / ui / src / app / components / datasource-func.directive.js View on Github external
scope.showColorPicker = function (event, dataKey) {
            $mdColorPicker.show({
                value: dataKey.color,
                defaultValue: '#fff',
                random: tinycolor.random(),
                clickOutsideToClose: false,
                hasBackdrop: false,
                multiple: true,
                preserveScope: false,

                mdColorAlphaChannel: true,
                mdColorSpectrum: true,
                mdColorSliders: true,
                mdColorGenericPalette: false,
                mdColorMaterialPalette: true,
                mdColorHistory: false,
                mdColorDefaultTab: 2,

                $event: event

            }).then(function (color) {
github intuit / auto / packages / core / src / git.ts View on Github external
async updateLabel(name: string, label: ILabelDefinition) {
    this.logger.verbose.info(`Updating "${name}" label :\n${label.name}`);

    const color = label.color
      ? tinyColor(label.color).toString('hex6')
      : tinyColor.random().toString('hex6');
    const result = await this.github.issues.updateLabel({
      current_name: label.name,
      name: label.name,
      owner: this.options.owner,
      repo: this.options.repo,
      color: color.replace('#', ''),
      description: label.description
    });

    this.logger.veryVerbose.info('Got response from updateLabel\n', result);
    this.logger.verbose.info('Updated label on GitHub.');

    return result;
  }