class ChartsDefaultColors in Charts 5.0.x
Same name and namespace in other branches
- 8.4 src/Settings/ChartsDefaultColors.php \Drupal\charts\Settings\ChartsDefaultColors
- 8.3 src/Settings/ChartsDefaultColors.php \Drupal\charts\Settings\ChartsDefaultColors
Class ChartsDefaultColors.
@package Drupal\charts\Settings
Hierarchy
- class \Drupal\charts\Settings\ChartsDefaultColors
Expanded class hierarchy of ChartsDefaultColors
3 files declare their use of ChartsDefaultColors
- ChartDataCollectorTable.php in src/
Element/ ChartDataCollectorTable.php - ChartsDefaultColorsTest.php in tests/
src/ Unit/ Settings/ ChartsDefaultColorsTest.php - ChartsDefaultSettingsTest.php in tests/
src/ Unit/ Settings/ ChartsDefaultSettingsTest.php
File
- src/
Settings/ ChartsDefaultColors.php, line 10
Namespace
Drupal\charts\SettingsView source
class ChartsDefaultColors {
/**
* Default colors.
*
* @var array
*/
protected $defaultColors = [
'#2f7ed8',
'#0d233a',
'#8bbc21',
'#910000',
'#1aadce',
'#492970',
'#f28f43',
'#77a1e5',
'#c42525',
'#a6c96a',
];
/**
* Default defined colors.
*
* @return array
* return default colors.
*/
public function getDefaultColors() {
return $this->defaultColors;
}
/**
* Define default colors.
*
* @param array $defaultColors
* Default colors.
*/
public function setDefaultColors(array $defaultColors) {
$this->defaultColors = $defaultColors;
}
/**
* Provide a random color.
*
* @return string
* A random color.
*/
public static function randomColor() {
return sprintf('#%06X', mt_rand(0, 0xffffff));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ChartsDefaultColors:: |
protected | property | Default colors. | |
ChartsDefaultColors:: |
public | function | Default defined colors. | |
ChartsDefaultColors:: |
public static | function | Provide a random color. | |
ChartsDefaultColors:: |
public | function | Define default colors. |