Function: php-ts-mode--colorize-css-value

php-ts-mode--colorize-css-value is a byte-compiled function defined in php-ts-mode.el.gz.

Signature

(php-ts-mode--colorize-css-value NODE OVERRIDE START END &rest _)

Documentation

Colorize CSS property value like css--fontify-region.

For NODE, OVERRIDE, START, and END, see treesit-font-lock-rules.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/php-ts-mode.el.gz
(defun php-ts-mode--colorize-css-value (node override start end &rest _)
  "Colorize CSS property value like `css--fontify-region'.
For NODE, OVERRIDE, START, and END, see `treesit-font-lock-rules'."
  (if (and php-ts-mode-css-fontify-colors
           (string-equal "plain_value" (treesit-node-type node)))
      (let ((color (css--compute-color start (treesit-node-text node t))))
        (when color
	  (with-silent-modifications
	    (add-text-properties
	     (treesit-node-start node) (treesit-node-end node)
	     (list 'face (list :background color
			       :foreground (readable-foreground-color
                                            color)
			       :box '(:line-width -1)))))))
    (treesit-fontify-with-override
     (treesit-node-start node) (treesit-node-end node)
     'font-lock-variable-name-face
     override start end)))