You are here

protected function Chartjs::getTranslucentColor in Charts 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/charts_chartjs/src/Plugin/chart/Library/Chartjs.php \Drupal\charts_chartjs\Plugin\chart\Library\Chartjs::getTranslucentColor()

Get translucent color.

Parameters

string $color: The color.

Return value

string The color.

1 call to Chartjs::getTranslucentColor()
Chartjs::populateDatasets in modules/charts_chartjs/src/Plugin/chart/Library/Chartjs.php
Populate Dataset.

File

modules/charts_chartjs/src/Plugin/chart/Library/Chartjs.php, line 446

Class

Chartjs
Define a concrete class for a Chart.

Namespace

Drupal\charts_chartjs\Plugin\chart\Library

Code

protected function getTranslucentColor($color) {
  if (!$color) {
    return '';
  }
  $rgb = Color::hexToRgb($color);
  return 'rgba(' . implode(",", $rgb) . ',' . 0.5 . ')';
}