You are here

public static function ChartsDefaultColors::randomColor in Charts 8.4

Same name and namespace in other branches
  1. 5.0.x src/Settings/ChartsDefaultColors.php \Drupal\charts\Settings\ChartsDefaultColors::randomColor()

Provide a random color.

Return value

string A random color.

3 calls to ChartsDefaultColors::randomColor()
ChartDataCollectorTable::getSeriesFromCollectedTable in src/Element/ChartDataCollectorTable.php
Gets the series from the data collected by this element.
ChartDataCollectorTable::initializeEmptyTable in src/Element/ChartDataCollectorTable.php
Initializes an empty table.
ChartDataCollectorTable::processDataCollectorTable in src/Element/ChartDataCollectorTable.php
Processes the element to render a table to collect a data for the chart.

File

src/Settings/ChartsDefaultColors.php, line 56

Class

ChartsDefaultColors
Class ChartsDefaultColors.

Namespace

Drupal\charts\Settings

Code

public static function randomColor() {
  return sprintf('#%06X', mt_rand(0, 0xffffff));
}