You are here

function _high_contrast_build_css in High contrast 8

Function for building a custom high contrast stylesheet.

Parameters

string $background: The hex color value to use as background.

string $text: The hex color value to use for texts.

string $hyperlink: The hex color value to use for hyperlinks.

Return value

string The compiled CSS.

1 call to _high_contrast_build_css()
ConfigEventSubscriber::updateStylesheet in src/EventSubscriber/ConfigEventSubscriber.php
Regenerate the stylesheet.

File

./high_contrast.module, line 75
Allows users to switch to a high contrast version of the active theme.

Code

function _high_contrast_build_css($background, $text, $hyperlink) {
  $css = '
* {
  background-color: ' . $background . ' !important;
  background-image: none !important;
  color: ' . $text . ' !important;
  line-height: 1.5em !important;
  text-shadow: none !important;
}

a, a * {
  background-color: ' . $background . ' !important;
  color: ' . $hyperlink . ' !important;
  text-decoration: underline !important;
}

a:hover, a:hover * {
  background-color: ' . $hyperlink . ' !important;
  color: ' . $background . ' !important;
  text-decoration: none !important;
}

input {
  background-color: ' . $text . ' !important;
  color: ' . $background . ' !important;
}

input[type=submit],
input[type=button],
button {
  background-color: ' . $hyperlink . ' !important;
  color: ' . $background . ' !important;
}

input[type=submit]:hover,
input[type=button]:hover,
button:hover {
  text-decoration: underline !important;
}

::selection {
  background-color: cyan !important;
  color: ' . $background . ' !important;
}
';
  return $css;
}