{"id":26849354,"url":"https://github.com/developmentcool2449/colorful-mode","last_synced_at":"2026-02-19T23:02:01.787Z","repository":{"id":232708448,"uuid":"784987543","full_name":"DevelopmentCool2449/colorful-mode","owner":"DevelopmentCool2449","description":"🎨Preview any color in your buffer","archived":false,"fork":false,"pushed_at":"2025-11-21T02:17:55.000Z","size":2607,"stargazers_count":109,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-21T04:11:13.499Z","etag":null,"topics":["emacs-lisp","emacs-package","highlight"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DevelopmentCool2449.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":"CONTRIBUTING.ORG","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-11T00:46:54.000Z","updated_at":"2025-11-21T02:17:59.000Z","dependencies_parsed_at":"2024-04-15T00:33:10.637Z","dependency_job_id":"208e9b92-b9a3-4684-af38-3f9a42f4b660","html_url":"https://github.com/DevelopmentCool2449/colorful-mode","commit_stats":null,"previous_names":["developmentcool2449/colorful-mode"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/DevelopmentCool2449/colorful-mode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopmentCool2449%2Fcolorful-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopmentCool2449%2Fcolorful-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopmentCool2449%2Fcolorful-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopmentCool2449%2Fcolorful-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DevelopmentCool2449","download_url":"https://codeload.github.com/DevelopmentCool2449/colorful-mode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DevelopmentCool2449%2Fcolorful-mode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29636040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T22:32:43.237Z","status":"ssl_error","status_checked_at":"2026-02-19T22:32:38.330Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs-lisp","emacs-package","highlight"],"created_at":"2025-03-30T21:33:18.687Z","updated_at":"2026-02-19T23:02:01.762Z","avatar_url":"https://github.com/DevelopmentCool2449.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+OPTIONS: _:nil\n#+title: colorful-mode\n#+subtitle: Preview any color in your buffer in real time.\n#+author: Elias G. Perez\n\n[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/colorful-mode-logo.svg]]\n\n #+BEGIN_QUOTE\n Preview any color in your buffer in real time.\n #+END_QUOTE\n\n#+html: \u003ca href=\"https://elpa.gnu.org/packages/colorful-mode.html\"\u003e\u003cimg alt=\"GNU ELPA\" src=\"https://elpa.gnu.org/packages/colorful-mode.svg\"/\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://jcs-emacs.github.io/jcs-elpa/\"\u003e\u003cimg alt=\"JCS ELPA\" src=\"https://raw.githubusercontent.com/jcs-emacs/badges/master/elpa/v/colorful-mode.svg\"\u003e\u003c/a\u003e\n#+html: \u003ca href=\"https://github.com/DevelopmentCool2449/colorful-mode/actions/workflows/test.yml\"\u003e\u003cimg alt=\"CI\" src=\"https://github.com/DevelopmentCool2449/colorful-mode/actions/workflows/test.yml/badge.svg\"\u003e\u003c/a\u003e\n\n#+html: \u003cimg src=\"https://raw.githubusercontent.com/DevelopmentCool2449/emacs-svg-badges/main/elisp_logo_warning.svg\" align=\"right\" width=\"10%\"\u003e\n\n🎨 =colorful-mode= is a minor mode that allow you highlight/preview any color\nformat such as *color hex* and *color names*, in your current buffer\nin real time and in a user friendly way based/inspired on 🌈[[https://elpa.gnu.org/packages/rainbow-mode.html][rainbow-mode.el]].\n\n* Features ✨\n- Real time color highlight.\n- Supports:\n  - Hexadecimal (#RRGGBB, #RGB, #RRGGBBAA, #RGBA).\n  - Color names (Emacs, HTML, CSS).\n  - CSS\n    - rgb/rgba\n    - hsl/hsla\n    - oklab/oklch\n    - user-defined colors variables:\n      - gtk @define-color\n      - var()\n  - LaTeX colors (gray, rbg, RGB, HTML)\n- Convert current color at point or in region to other formats\n  such as hexadecimal or color names *(only available for some colors)*\n  with mouse click support.\n- Prefix/suffix string instead highlight /(Optional)/.\n- Highlight only in strings /(Optional)/.\n- Blacklist color keywords from being highlighted.\n\n* Screenshots and animated GIFs 📷\n\n[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/screenshot1.png]]\nSupports for both GUI/TUI.\n\n[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/screenshot2.png]]\nSupport for custom color string indicator.\n\n[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/gif1.gif]]\n\n[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/gif2.gif]]\nChange color support in real time.\n\n[[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/assets/gif3.gif]]\nSupport for color changing at region.\n\n* User Options 🔧\n** Customizable User options\n- =colorful-allow-mouse-clicks (default: t)= If non-nil, allow using mouse buttons\n  for change color.\n- =colorful-use-prefix (default: nil)= If non-nil, use prefix for preview color\n  instead highlight them.\n\n#+begin_quote\n[!WARNING]\n\ncss-derived modes colorize rgb and hex colors out the box,\nthis may interfere with colorful prefix, you can disable this setting\n'css-fontify-colors' to nil\n#+end_quote\n\n- =colorful-prefix-string (default: \"●\")= String to be used in highlights.\n  Only relevant if `colorful-use-prefix' is non-nil.\n- =colorful-prefix-alignment (default: 'left)= The position to put prefix string.\n  The value can be left or right.\n  Only relevant if `colorful-use-prefix' is non-nil.\n- =colorful-extra-color-keyword-functions=\n  default:\n  '(colorful-add-hex-colors\n    (emacs-lisp-mode . colorful-add-color-names)\n    ((html-mode css-mode) .\n     (colorful-add-css-variables-colors\n      colorful-add-rgb-colors\n      colorful-add-hsl-colors\n      colorful-add-oklab-oklch-colors\n      colorful-add-color-names))\n    (latex-mode . colorful-add-latex-colors))\n  List of functions to add extra color keywords to colorful-color-keywords.\n\n  It can be a cons cell specifying the mode (or a list of modes)\n  e.g:\n\n  (((css-mode css-ts-mode) . colorful-add-rgb-colors)\n    (emacs-lisp-mode . (colorful-add-color-names\n                        colorful-add-rgb-colors))\n    ((text-mode html-mode) . (colorful-add-color-names\n                              colorful-add-rgb-colors))\n    ...)\n\n  Or a simple list of functions for executing wherever colorful is active:\n  (colorful-add-color-names\n    colorful-add-rgb-colors)\n\n  Available functions are:\n  + colorful-add-hex-colors.\n  + colorful-add-color-names.\n  + colorful-add-css-variables-colors.\n  + colorful-add-rgb-colors.\n  + colorful-add-hsl-colors.\n  + colorful-add-latex-colors\n\n- =colorful-exclude-colors (default: '(\"#define\"))= List of keywords not to highlight.\n- =colorful-short-hex-conversions (default: t)= If non-nil, colorful\n  will converted long hex colors to \\\"#RRGGBB\\\" format.  Setting this\n  to non-nil can make converted hex inaccurate.\n- =colorful-only-strings (default: nil)= If non-nil, colorful will only highlight colors inside strings.\n  If set to `only-prog', the colors in `prog-mode' will be highlighted\n  only if they are inside a string, this doesn't include `css-mode' and\n  derived.\n- =colorful-highlight-in-comments= If non-nil, colorful will highlight colors inside comments.\n  NOTE: If this is set, this will highlight any keyword within the\n  comments, including color names, which can be annoying.\n- =colorful-html-colors-alist= Alist of HTML colors. Each entry should have the form (COLOR-NAME . HEXADECIMAL-COLOR).\n- =global-colorful-modes (default: '(prog-mode help-mode html-mode css-mode latex-mode))= Which major modes global-colorful-mode is switched on in (globally).\n\n** Faces\n- =colorful-base= Face used as base for highlight color names.\n  Changing background or foreground color will have no effect.\n\n** Interactive User Functions.\n- =colorful-change-or-copy-color= Change or copy color at point to\n  another format.\n- =colorful-convert-and-change-color= Convert color at point or colors\n  in region to another format.\n- =colorfu-convert-and-copy-color= Convert color at point to another\n  format and copy it to the kill ring.\n- =colorful-mode= Buffer-local minor mode.\n- =global-colorful-mode= Global minor mode.\n\n** Key bindings\nThese key bindings are defined by: =colorful-mode-map=\n- =C-x c x= → =colorful-change-or-copy-color=.\n- =C-x c c= → =colorful-convert-and-copy-color=.\n- =C-x c r= → =colorful-convert-and-change-color=.\n\n* Setups and Guides 📖\n\n** Enabling colors to specifics major-modes\nIf you want to use css rgb colors outside css-derived modes, you\ncan add them to `colorful-extra-color-keyword-functions' in your config.\n\n#+begin_src elisp\n  (add-to-list 'colorful-extra-color-keyword-functions '(insert-your-major-mode . colorful-add-rgb-colors))\n#+end_src\n\nIf you want also use hsl and rgb together you can use this\n#+begin_src elisp\n  (add-to-list 'colorful-extra-color-keyword-functions '(insert-your-major-mode . (colorful-add-rgb-colors colorful-add-hsl-colors)))\n#+end_src\n\ncolorful provides extra functions out-the-box that enable additional\nhighlighting:\n\n- =colorful-add-hex-colors=: Add Hexadecimal colors highlighting.\n- =colorful-add-color-names=: Add color names highlighting.\n- =colorful-add-css-variables-colors=: Add CSS user-defined color variables highlighting.\n- =colorful-add-rgb-colors=: Add CSS RGB colors highlighting.\n- =colorful-add-oklab-oklch-colors=: Add CSS OkLab and OkLch colors highlighting.\n- =colorful-add-hsl-colors=: Add CSS HSL colors highlighting.\n- =colorful-add-latex-colors=: Add LaTeX rgb/RGB/HTML/Grey colors highlighting.\n\nSee: =colorful-extra-color-keyword-functions= for more details.\n\n* Usage and Installation 📦\nIt's recommended that you must use emacs-28.x or higher.\n\nFor install colorful run:\n- =M-x package-install colorful-mode=\n\nOnce you have it installed you can activate colorful locally in your\nbuffer with =M-x colorful-mode=, if want enable it globally without\nusing hooks then you can do =M-x global-colorful-mode=\n\n* Configuration ⚙️\n\nExample /(Personal)/ configuration for your =init.el=:\n\n#+begin_src emacs-lisp\n(use-package colorful-mode\n  ;; :diminish\n  ;; :ensure t ; Optional\n  :custom\n  (colorful-use-prefix t)\n  (colorful-only-strings 'only-prog)\n  (css-fontify-colors nil)\n  :config\n  (global-colorful-mode t)\n  (add-to-list 'global-colorful-modes 'helpful-mode))\n#+end_src\n\n** Disable colorful in regions\n\nIf you want to disable colorful at region this hack may be useful\nfor you:\n\n#+begin_src emacs-lisp\n(add-hook 'post-command-hook\n          (lambda ()\n            \"delete colorful overlay on active mark\"\n            (when-let* (colorful-mode\n                        (beg (use-region-beginning))\n                        (end (use-region-end)))\n              ;; Remove full colorful overlay instead only the part where\n              ;; the region is.\n                  (dolist (ov (overlays-in beg end))\n                    (when (overlay-get ov 'colorful--overlay)\n                      (delete-overlay ov))))))\n\n(add-hook 'deactivate-mark-hook\n          (lambda ()\n            \"refontify deleted mark\"\n            (when-let* (colorful-mode\n                        (beg (region-beginning))\n                        (end (region-end)))\n              (font-lock-flush beg end))))\n#+end_src\n\n* How does it compare to =rainbow-mode= or built-in =css fontify colors=?\n=colorful-mode= improves =rainbow-mode= and =css fontify-colors= in adding more features:\n\n| Comparison                                            | colorful-mode.el | rainbow-mode.el | built-in css-mode |\n|-------------------------------------------------------+------------------+-----------------+-------------------|\n| Compatible with hl-line and other overlays?           | ✓               | ❌             | ❌               |\n| Convert color to other formats?                       | ✓               | ❌             | ✓                |\n| Optionally use string prefix/suffix instead highlight | ✓               | ❌             | ❌               |\n| Blacklist colors?                                     | ✓               | ❌^{1}            | ❌               |\n| Allow highlight specifics colors in specific modes    | ✓               | ✓^{2}             | ❌               |\n| Optionally highlight only in strings                  | ✓               | ❌             | ❌               |\n| No performance issues?^{3}                               | ❌              | ✓              | ✓                |\n\n#+begin_src text\n[1] rainbow-mode (like colorful) uses regex for highlight some\n    keywords, however it cannot exclude specifics colors (such as\n    \"#def\" that overrides C \"#define\" keyword).\n[2] Only for some colors.\n[3] I didn't a benchmark however due colorful-mode uses overlays\n    instead text properties it can be a bit slow.\n#+end_src\n\nThe intention is to provide a featured alternative to\n=rainbow-mode.el= and =css-fontify-colors= with a user-friendly approach.\n\nIf you prefer only highlights without color conversion, prefix/suffix\nstring indicator and/or anything else you can use =rainbow-mode.el=.\n\nor something built-in and just for css then use built-in\ncss-fontify-colors which is activated by default\n\nOn the other hand, if you want convert colors, overlays, optional\nprefix strings and more features you can use =colorful-mode.el=.\n* [[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/CONTRIBUITING.org][How to Contribute]]\ncolorful-mode is part of GNU ELPA, if you want send patches you will\nneed assign copyright to the Free Software Foundation.\nPlease see the [[https://raw.githubusercontent.com/DevelopmentCool2449/colorful-mode/main/CONTRIBUITING.org][CONTRIBUTING.org]] file for getting more information.\n\n#+html: \u003cimg src=\"https://raw.githubusercontent.com/DevelopmentCool2449/emacs-svg-badges/main/powered_by_emacs.svg\" align=\"left\" width=\"10%\" alt=\"Powered by GNU Emacs\"\u003e\n#+html: \u003cimg src=\"https://raw.githubusercontent.com/DevelopmentCool2449/emacs-svg-badges/main/powered_by_org_mode.svg\" align=\"right\" width=\"10%\" alt=\"Powered by Org Mode\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentcool2449%2Fcolorful-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopmentcool2449%2Fcolorful-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentcool2449%2Fcolorful-mode/lists"}