css.php 511 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * CSS-related helpers
  4. *
  5. * @package vamtam/consulting
  6. */
  7. /**
  8. * Map an accent name to its value
  9. *
  10. * @param string $color accent name
  11. * @param string|bool $deprecated
  12. * @return string hex color or the input string
  13. */
  14. function vamtam_sanitize_accent( $color, $deprecated = false ) {
  15. if ( preg_match( '/accent(?:-color-)?(\d)/i', $color, $matches ) ) {
  16. $num = (int) $matches[1];
  17. $color = "var( --vamtam-accent-color-{$num} )";
  18. }
  19. return $color;
  20. }