DevelopmentCool2449 / colorful-mode

🎨Preview any color in your buffer
GNU General Public License v3.0
55 stars 3 forks source link
emacs-lisp emacs-package rainbow-mode

+title: colorful-mode

+subtitle: Preview any color in your buffer in real time.

+author: Elias G. Perez

+language: en

+export_file_name: colorful-mode.texi

+texinfo_dir_category: Emacs misc features

+texinfo_dir_title: colorful-mode: (colorful-mode).

+texinfo_dir_desc: Preview color hexs in your buffer

[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/colorful-mode-logo.svg]]

+BEGIN_QUOTE

Preview any color in your buffer in real time.

+END_QUOTE

+html: GNU ELPA

+html: JCS ELPA

+html: CI

+html:

🎨 =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 🌈[[https://elpa.gnu.org/packages/rainbow-mode.html][rainbow-mode.el]].

[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/gif2.gif]] [[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/gif3.gif]] [[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/screenshot1.png]] [[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/screenshot2.png]]

[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/screenshot3.png]] /With a custom prefix (in this example a custom character)/.

** Faces

** Interactive User Functions.

** Key bindings These key bindings are defined by: =colorful-mode-map=

** Adding extra colors Colorful by default provides extra functions that highlight additional colors:

For use them add it to:

+begin_src emacs-lisp

;; In this example add emacs color names only for yaml-mode and derived. (add-to-list 'colorful-extra-color-keyword-functions '(yaml-mode . colorful-add-color-names))

+end_src

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

For install colorful run:

Once you have it installed you can run 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=

Or if you prefer using =use-package= macro:

+begin_src emacs-lisp

(use-package colorful-mode :ensure t ; Optional :hook (prog-mode text-mode) ...)

+end_src

+BEGIN_COMMENT

Author note: Please add a comparation table with colorful-mode alternatives such as rainbow-mode, built-in css-mode color preview ...

+END_COMMENT

| Comparation | colorful-mode.el | rainbow-mode.el | |-------------------------------------------------------+------------------+-----------------| | Compatible with hl-line and other overlays? | βœ“ | ❌ | | Convert color to other formats? | βœ“ | ❌ | | Opcionally use string prefix/suffix instead highlight | βœ“ | ❌ | | Exclude keywords/colors? | βœ“ | ❌^{1} | | Allow highlight specifics colors in specific modes | βœ“ | βœ“^{2} | | Opcionally highlight only in strings | βœ“ | ❌ | | No performance issues?^{3} | ❌ | βœ“ |

+begin_src text

[1] rainbow-mode (like colorful) uses regex for highlight some keywords, however it cannot exclude specifics colors keywords (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.

+end_src

The intention is to provide a featured alternative to =rainbow-mode.el= with a user-friendly approach.

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

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

+html: Powered by GNU Emacs

+html: Powered by Org Mode