From ff5d0debba448ca789ed6ef23f4217554d5dea56 Mon Sep 17 00:00:00 2001 From: lomna-dev Date: Wed, 10 May 2023 00:54:01 +0530 Subject: [PATCH] Simple python script to convert 16 color to emacs scheme * python-xresources-emacs/convert.py: Converts 16 color scheme to emacs theme --- python-xresources-emacs/convert.py | 94 ++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 python-xresources-emacs/convert.py diff --git a/python-xresources-emacs/convert.py b/python-xresources-emacs/convert.py new file mode 100644 index 0000000..1ac745c --- /dev/null +++ b/python-xresources-emacs/convert.py @@ -0,0 +1,94 @@ +print(""" +(deftheme {theme_name} + "Add some description here") + +(let ((class '((class color) (min-colors 89)))) + (custom-theme-set-faces + '{theme_name} + `(default ((,class (:background "{bg}" :foreground "{fg}")))) + `(cursor ((,class (:background "{fg}" :foreground "{fg}")))) + ;; Highlighting faces + `(fringe ((,class (:background "{bg}")))) + `(highlight ((,class (:background "{bg}" :underline t)))) + `(region ((t (:background ,"{blue}")) + (t :inverse-video t))) + `(secondary-selection ((,class (:background "{bg}")))) + `(isearch ((,class (:background "{bg}" :foreground "{blue}" :weight bold)))) + `(isearch-fail ((t (:foreground "{fg}" :background "{red}")))) + `(lazy-highlight ((,class (:background "{bg}" :foreground "{yellow}" :weight bold)))) + ;; Mode line faces + `(mode-line ((,class (:background "{black}" :foreground "{white}")))) + `(mode-line-inactive ((,class (:background "{bright_black}" :foreground "{bright_white}")))) + ;; Escape and prompt faces + `(minibuffer-prompt ((,class (:foreground "{cyan}")))) + `(escape-glyph ((,class (:foreground "{yellow}" :weight bold)))) + `(homoglyph ((,class (:foreground "{green}" :weight bold)))) + ;; Font lock faces, this is where all source file highlighing is done + `(font-lock-builtin-face ((,class (:foreground "{fg}" :weight bold)))) + `(font-lock-comment-face ((,class (:foreground "{green}")))) + `(font-lock-constant-face ((,class (:foreground "{green}")))) + `(font-lock-function-name-face ((,class (:foreground "{cyan}")))) + `(font-lock-keyword-face ((,class (:foreground "{bright_red}" :weight bold)))) + `(font-lock-string-face ((,class (:foreground "{green}")))) + `(font-lock-type-face ((,class (:foreground "{yellow}" :weight bold)))) + `(font-lock-variable-name-face ((,class (:foreground "{white}")))) + `(font-lock-warning-face ((,class (:foreground "{red}" :weight bold)))) + ;; Button and link faces + `(link ((,class (:foreground "{blue}" :underline t)))) + `(link-visited ((,class (:foreground "{bright_blue}" :underline t)))) + `(button ((,class (:background "{bright_black}" :foreground "{bright_white}")))) + `(header-line ((,class (:background "{bg}" :foreground "{bright_yellow}")))) + ;; Gnus faces + ;; `(gnus-group-news-1 ((,class (:weight bold :foreground "#95e454")))) + ;; `(gnus-group-news-1-low ((,class (:foreground "#95e454")))) + ;; `(gnus-group-news-2 ((,class (:weight bold :foreground "#cae682")))) + ;; `(gnus-group-news-2-low ((,class (:foreground "#cae682")))) + ;; `(gnus-group-news-3 ((,class (:weight bold :foreground "#ccaa8f")))) + ;; `(gnus-group-news-3-low ((,class (:foreground "#ccaa8f")))) + ;; `(gnus-group-news-4 ((,class (:weight bold :foreground "#99968b")))) + ;; `(gnus-group-news-4-low ((,class (:foreground "#99968b")))) + ;; `(gnus-group-news-5 ((,class (:weight bold :foreground "#cae682")))) + ;; `(gnus-group-news-5-low ((,class (:foreground "#cae682")))) + ;; `(gnus-group-news-low ((,class (:foreground "#99968b")))) + ;; `(gnus-group-mail-1 ((,class (:weight bold :foreground "#95e454")))) + ;; `(gnus-group-mail-1-low ((,class (:foreground "#95e454")))) + ;; `(gnus-group-mail-2 ((,class (:weight bold :foreground "#cae682")))) + ;; `(gnus-group-mail-2-low ((,class (:foreground "#cae682")))) + ;; `(gnus-group-mail-3 ((,class (:weight bold :foreground "#ccaa8f")))) + ;; `(gnus-group-mail-3-low ((,class (:foreground "#ccaa8f")))) + ;; `(gnus-group-mail-low ((,class (:foreground "#99968b")))) + ;; `(gnus-header-content ((,class (:foreground "#8ac6f2")))) + ;; `(gnus-header-from ((,class (:weight bold :foreground "#95e454")))) + ;; `(gnus-header-subject ((,class (:foreground "#cae682")))) + ;; `(gnus-header-name ((,class (:foreground "#8ac6f2")))) + ;; `(gnus-header-newsgroups ((,class (:foreground "#cae682")))) + + ;; set ansi-colors + `(ansi-color-black ((t (:foreground "{black}")))) + `(ansi-color-white ((t (:foreground "{white}")))) + `(ansi-color-red ((t (:foreground "{red}")))) + `(ansi-color-yellow ((t (:foreground "{yellow}")))) + `(ansi-color-green ((t (:foregrounB "{green}")))) + `(ansi-color-cyan ((t (:foreground "{cyan}")))) + `(ansi-color-blue ((t (:foreground "{blue}")))) + `(ansi-color-magenta ((t (:foregrou0E "{magenta}")))) + `(ansi-color-bright-black ((t (:foreground "{bright_black}")))) + `(ansi-color-bright-white ((t (:foreground "{bright_white}")))) + `(ansi-color-bright-red ((t (:foreground "{bright_red}")))) + `(ansi-color-bright-yellow ((t (:foreground "{bright_yellow}")))) + `(ansi-color-bright-green ((t (:foreground "{bright_green}")))) + `(ansi-color-bright-cyan ((t (:foreground "{bright_cyan}")))) + `(ansi-color-bright-blue ((t (:foreground "{bright_blue}" )))) + `(ansi-color-bright-magenta ((t (:foreground "{bright_magenta}")))) + + ;; Message faces + ;; `(message-header-name ((,class (:foreground "#8ac6f2" :weight bold)))) + ;; `(message-header-cc ((,class (:foreground "#95e454")))) + ;; `(message-header-other ((,class (:foreground "#95e454")))) + ;; `(message-header-subject ((,class (:foreground "#cae682")))) + ;; `(message-header-to ((,class (:foreground "#cae682")))) + ;; `(message-cited-text ((,class (:foreground "#99968b")))) + `(message-separator ((,class (:foreground "{white}" :weight bold)))))) + +(provide-theme '{theme_name}) +""".format(theme_name="anmol-test",bg="#100f1f", fg="#e0e892", black="#212125", red="#bc2a2a", green="#3eca3e", yellow="#dcdc0f", blue="#6d6df3", magenta="#d068d0", cyan="#0dcbcb", white="#e2e2e2", bright_black="#80776f", bright_red="#bc2121", bright_green="#3eca3e", bright_yellow="#dcdc00", bright_blue="#915bf3", bright_magenta="#d040d0", bright_cyan="#00cbcb", bright_white="#f5f5f5"))