A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/DevelopmentCool2449/colorful-mode below:

DevelopmentCool2449/colorful-mode: 🎨Preview any color in your buffer

Preview any color in your buffer in real time.

🎨 colorful-mode is a minor mode that allow you highlight/preview any color format such as color hex and color names, in your current buffer in real time and in a user friendly way based/inspired on 🌈rainbow-mode.el.

Screenshots and animated GIFs 📷

Supports for both GUI/TUI.

Support for custom color string indicator.

Change color support in real time.

Support for color changing at region.

Customizable User options

Warning

css-derived modes colorize rgb and hex colors out the box, this may interfere with colorful prefix, you can disable this setting ‘css-fontify-colors’ to nil

Interactive User Functions.

These key bindings are defined by: colorful-mode-map

Enabling colors to specifics major-modes

If you want to use css rgb colors outside css-derived modes, you can add them to `colorful-extra-color-keyword-functions’ in your config.

(add-to-list 'colorful-extra-color-keyword-functions '(insert-your-major-mode . colorful-add-rgb-colors))

If you want also use hsl and rgb together you can use this

(add-to-list 'colorful-extra-color-keyword-functions '(insert-your-major-mode . (colorful-add-rgb-colors colorful-add-hsl-colors)))

colorful provides extra functions out-the-box that enable additional highlighting:

See: colorful-extra-color-keyword-functions for more details.

Usage and Installation 📦

It’s recommended that you must use emacs-28.x or higher.

For install colorful run:

Once you have it installed you can activate colorful locally in your buffer with M-x colorful-mode, if want enable it globally without using hooks then you can do M-x global-colorful-mode

Example (Personal) configuration for your init.el:

(use-package colorful-mode
  ;; :diminish
  ;; :ensure t ; Optional
  :custom
  (colorful-use-prefix t)
  (colorful-only-strings 'only-prog)
  (css-fontify-colors nil)
  :config
  (global-colorful-mode t)
  (add-to-list 'global-colorful-modes 'helpful-mode))
Disable colorful in regions

If you want to disable colorful at region this hack may be useful for you:

(add-hook 'post-command-hook
          (lambda ()
            "delete colorful overlay on active mark"
            (when-let* (colorful-mode
                        (beg (use-region-beginning))
                        (end (use-region-end)))
              ;; Remove full colorful overlay instead only the part where
              ;; the region is.
                  (dolist (ov (overlays-in beg end))
                    (when (overlay-get ov 'colorful--overlay)
                      (delete-overlay ov))))))

(add-hook 'deactivate-mark-hook
          (lambda ()
            "refontify deleted mark"
            (when-let* (colorful-mode
                        (beg (region-beginning))
                        (end (region-end)))
              (font-lock-flush beg end))))
How does it compare to rainbow-mode or built-in css fontify colors?

colorful-mode improves rainbow-mode and css fontify-colors in adding more features:

Comparison colorful-mode.el rainbow-mode.el built-in css-mode Compatible with hl-line and other overlays? ✓ ❌ ❌ Convert color to other formats? ✓ ❌ ✓ Optionally use string prefix/suffix instead highlight ✓ ❌ ❌ Blacklist colors? ✓ ❌1 ❌ Allow highlight specifics colors in specific modes ✓ ✓2 ❌ Optionally highlight only in strings ✓ ❌ ❌ No performance issues?3 ❌ ✓ ✓
[1] rainbow-mode (like colorful) uses regex for highlight some
    keywords, however it cannot exclude specifics colors (such as
    "#def" that overrides C "#define" keyword).
[2] Only for some colors.
[3] I didn't a benchmark however due colorful-mode uses overlays
    instead text properties it can be a bit slow.

The intention is to provide a featured alternative to rainbow-mode.el and css-fontify-colors with a user-friendly approach.

If you prefer only highlights without color conversion, prefix/suffix string indicator and/or anything else you can use rainbow-mode.el.

or something built-in and just for css then use built-in css-fontify-colors which is activated by default

On the other hand, if you want convert colors, overlays, optional prefix strings and more features you can use colorful-mode.el.

colorful-mode is part of GNU ELPA, if you want send patches you will need assign copyright to the Free Software Foundation. Please see the CONTRIBUTING.org file for getting more information.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4