You are here

function image_effects_preprocess_image_effects_color_detail in Image Effects 8

Same name and namespace in other branches
  1. 8.3 image_effects.module \image_effects_preprocess_image_effects_color_detail()
  2. 8.2 image_effects.module \image_effects_preprocess_image_effects_color_detail()

Prepares variables to get a color info.

Default template: image-effects-color-detail.html.twig.

File

./image_effects.module, line 160
Provides effects and operations for the Image API.

Code

function image_effects_preprocess_image_effects_color_detail(&$variables) {
  $variables['#attached']['library'][] = 'image_effects/image_effects.admin.ui';
  if ($variables['color']) {
    if ($variables['border']) {
      if ($variables['border_color'] == 'matchLuma') {
        $variables['border_color'] = ColorUtility::matchLuma($variables['color']);
      }
      else {
        $variables['border_color'] = Unicode::substr($variables['border_color'], 0, 7);
      }
    }
    $variables['color_opacity'] = ColorUtility::rgbaToOpacity($variables['color']);
    $variables['color'] = Unicode::substr($variables['color'], 0, 7);
  }
}