zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
25.01k stars 1.17k forks source link

request: cobalt color scheme #967

Closed tulakalbeyo closed 6 years ago

tulakalbeyo commented 6 years ago

cobalt color scheme rocks my world. is anybody is up for doing it, it'd be really happy. this is such a kick-ass editor! thanks!

sum01 commented 6 years ago

Here's the guide if you want to do it yourself. Otherwise I could probably do it, but I'd need an example from another editor or whatever, as I don't know what that looks like.

tulakalbeyo commented 6 years ago

hopefully this is a good enough reference ^_^ https://emacsthemes.com/themes/cobalt-theme.html I'll buy you a beer if you can pull it off. thanks!

sum01 commented 6 years ago

I'm trying to make it, but I couldn't find docs explaining what the Emacs settings actually translate to, so it's a bit of a guessing game. The Micro docs for colorscheme are also lacking, with only a few things actually explained.

tulakalbeyo commented 6 years ago

maybe this is of some help?

some definitions https://github.com/mig/gedit-themes/blob/master/cobalt.xml

a screenshot https://delightlylinux.files.wordpress.com/2015/03/0_cobalt.gif

thank you again in advance

zyedidia commented 6 years ago

It seems to me like https://github.com/emacs-jp/replace-colorthemes/blob/master/cobalt-theme.el would also provide some useful information.

tommyshem commented 6 years ago

If on linux make sure true color is set by below or the colors will be wrong as I found out when testing.

 export MICRO_TRUECOLOR=1

Try below, just copy to a file named cobalt.micro in to folder ~/.config/micro/colorschemes

# Cobalt color scheme
# Editor colors
color-link default "#F8F8F8,#09223F"          
color-link cursor-line "#00162A"
# color-link color-column "#26425D"
color-link statusline "#F8F8F8,#008AFF"            
color-link tabbar "#F8F8F8,#008AFF"               
color-link indent-char "#F8F8F8,#09223F"           
# Line number colour scheme
color-link line-number "#888888,#111111"           
color-link current-line-number "#888888,#111111"   
# Gutter color scheme
color-link gutter-info "#40FFB9,#09223F"
color-link gutter-error "#FF0000,#09223F"
color-link gutter-warning "#FF518C,#09223F"
# Message color scheme
color-link message "#008AFF,#09223F"
color-link error-message "#FF0000,#09223F"
# Syntax colors
color-link error "bold #FF0000,#09223F"
# comment
color-link comment "#008AFF,#09223F"
# identifier
color-link identifier "#FFDD00,#09223F"
# constant and subgroups
color-link constant "#FF518C,#09223F"
color-link constant.string "#42D915,#09223F"
# statement
color-link statement "#FA9E18,#09223F"
# symbol and subgroups
color-link symbol "#CCCCCC,#09223F"
# color-link symbol.brackets "default"
# preproc and subgroups
color-link preproc "#8090A2,#09223F"
color-link preproc.shebang "#008AFF,#09223F"    
# type and subgroups
color-link type "#FFEF79,#09223F"
# special
color-link special "#E9C062,#09223F"
# todo
color-link todo "bold #D33682,#09223F"
tulakalbeyo commented 6 years ago

thank you so much! close, but there are some minor details, though. i have attached a screenshot here

screenshot_2017-12-28_13-35-35

left window is gedit (for reference). top right window is xterm 322 with "export MICRO_TRUECOLOR=1". bottom right window is xfce4-terminal 0.6.3.

firstly: the background does not appear blue. secondly: line 36: "clear" should appear in orange, but doesn't.

thanks again!

(oh, and please send me your paypal address, so i can shoot you over that beer i promised!)

tommyshem commented 6 years ago

Looks like the terminal does not use true color, as this is what I got when testing, micro tries to match the closest color match when using 255 colors which looks bad. I will look into line 36 color. No need for payment, happy I could help you. What version of linux and distro are you using so I can test.

tulakalbeyo commented 6 years ago

I'm on Xubuntu 16.04. i wonder if the theme can be adapted to 256 colors, instead of true color. what terminal are you using? maybe I should switch to that instead of using my vanilla, generic terminal. thanks! and please reconsider accepting my gratitude.

tommyshem commented 6 years ago

I am using gnome terminal, I can look at a 255 color version, now I know what you are using for testing. I will post results here when I have a working version.

tulakalbeyo commented 6 years ago

that would be f***ing awesome, dude! ^_^

tommyshem commented 6 years ago

@tulakalbeyo I am struggling with the background color, can you please look at the color list below and pick a background color. Link to colors list that can be used in the terminal The highlighting problem is not with the color scheme but with the syntax file used by micro. clear and sudo are missing from the list of keywords and there might be more. If you get a list of missing highlighting commands then I could do a pull request to get them added.

tulakalbeyo commented 6 years ago

@tommyshem

background color: xterm #25 (DeepSkyBlue4 | #005f87) <-- this looks good ^_^

syntax highlighting: keywords = if fi then elif else for do done until while break continue case function return in eq ne ge le commands = alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format free fsck ftp gawk gedit getopts git grep groups gzip hash head history hostname id ifconfig import install join kill less let ln local locate logname logout look lpc lpr lprint lprintd lprintq lprm ls lsof make man micro mkdir mkfifo mkisofs mknod more mount mtools mv netstat nice nl nano nohup nslookup open op passwd paste pathchk ping popd pr printcap printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir vi watch wc whereis which who whoami wget xargs yes

thanks!

tommyshem commented 6 years ago

Try below, just copy to a file named cobalt.micro in to folder ~/.config/micro/colorschemes

# Cobalt color scheme
# Editor colors
color-link default "#FFFFFF,#005f87"
# #09223F
color-link cursor-line "#003b70"
# color-link color-column "#26425D"
color-link statusline "#F8F8F8,#008AFF"            
color-link tabbar "#F8F8F8,#008AFF"               
color-link indent-char "#F8F8F8,#09223F"           
# Line number colour scheme
color-link line-number "#888888,#111111"           
color-link current-line-number "#888888,#111111"   
# Gutter color scheme
color-link gutter-info "#00BF8C"
color-link gutter-error "#990000"
color-link gutter-warning "#FF518C"
# Message color scheme
color-link message "#0088FF"
color-link error-message "#990000"
# Syntax colors
color-link error "bold #990000"
# comment
color-link comment "#0088FF"
# identifier
color-link identifier "#80ffbb"
color-link identifier.var "#80ffbb"
# constant and subgroups
color-link constant "#ffee80"
color-link constant.string "#42D915"
color-link constant.number "#FF518C"
color-link constant.bool "#42D915"
# statement
color-link statement "bold #FA9E18"
# symbol and subgroups
color-link symbol "#FA9E18"
color-link symbol.bracket "#FA9E18"
# color-link symbol.brackets "default"
# preproc and subgroups
color-link preproc "#80ffbb"
color-link preproc.shebang "#0088FF"    
# type and subgroups
color-link type "bold #FA9E18"
# color-link type "bold #80ffbb"
# special
color-link special "bold #ff9d00"
# todo
color-link todo "bold #ffee80"

 # from Gedit cobalt style
 # faded_yellow"                value="#ffee80"/>
 # bright_orange"               value="#ff9d00"/>
 # faded_orange"                value="#ffb054"/>
 # nail_polish_pink"            value="#ff0044"/>
 # neon_pink"                   value="#ffdd00"/>
 # sky_blue"                    value="#0088ff"/>
 # teal_blue"                   value="#80ffbb"/>
 # light_blue"                  value="#0065bf"/>
 # medium_blue"                 value="#003b70"/>
 # dark_blue"                   value="#001b33"/>
 # black_blue"                  value="#000d1a"/>
 # white"                       value="#ffffff"/>
 # pale_grey"                   value="#eeeeee"/>
 # steel_grey"                  value="#333333"/>
 # spring_green"                value="#3ad900"/>
 # sea_green"                   value="#00BF8C"/>
 # light_grey"                  value="#cccccc"/>
 # dark_red"                    value="#990000"/>
 # bluish_grey"                 value="#777777"/>
 # steelblue3"                  value="#4f94cd"/>
 # dark_medium_blue_blend"      value="#00213F"/>

Change color

If there is a color you want to change just look at the link I gave you in the other post and change the # number to that value you want, then save file. (Note in 256 color terminal it might look different in different setup terminal emulators)

Remove color highlighting

If there is a color highlighting you do not want change the color value to "default"

Missing keywords

I will do a pull request to micro editor for the missing keywords later today. Or you can add them yourself to folder ~/.config/micro/syntax Make a file called sh.yaml and copy below code.

filetype: shell

detect:
    filename: "(\\.sh$|\\.bash|\\.bashrc|bashrc|\\.bash_aliases|bash_aliases|\\.bash_functions|bash_functions|\\.bash_profile|bash_profile|Pkgfile|pkgmk.conf|profile|rc.conf|PKGBUILD|.ebuild\\$|APKBUILD)"
    header: "^#!.*/(env +)?(ba)?sh( |$)"

rules:
    # Numbers
    - constant.number: "\\b[0-9]+\\b"
      # Conditionals and control flow
    - statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b"
    - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
      # Shell commands
    - type: "\\b(cd|echo|export|let|set|umask|unset)\\b"
      # Common linux commands
    - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b"
      # Coreutils commands
    - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|clear|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
      # Conditional flags
    - statement: "--[a-z-]+"
    - statement: "\\ -[a-z]+"

    - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
    - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"

    - constant.string:
        start: "\""
        end: "\""
        skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\."

    - constant.string:
        start: "'"
        end: "'"
        rules: []

    - comment:
        start: "(^|[[:space:]])#"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

Add the keywords you need (put | before and after every keyword, but at beginning of first keyword or not on the end of last keyword). I have put clear in add from there. Hope this helps you.

Any other problems let me know.

tulakalbeyo commented 6 years ago

@tommyshem

thank you so much!

i combined yours and mine's "coreutils commands"

alias|apropos|awk|base64|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chcon|chgrp|chmod|chown|chroot|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|declare|df|diff|diff3|dig|dir|dircolors|dirname|dirs|du|echo|egrep|eject|enable|env|ethtool|eval|exec|exit|expand|export|expr|factor|false|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|gawk|gedit|getopts|git|grep|groups|gzip|hash|head|history|hostid|hostname|id|ifconfig|import|install|join|kill|less|let|link|ln|local|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|md5sum|micro|mkdir|mkfifo|mkisofs|mknod|mktemp|more|mount|mtools|mv|nano|netstat|nice|nl|nohup|nproc|nslookup|numfmt|od|op|open|passwd|paste|pathchk|ping|pinky|popd|pr|printcap|printenv|printf|ps|ptx|pushd|pwd|quota|quotacheck|quotactl|ram|rcp|read|readlink|readonly|realpath|remsync|renice|rm|rmdir|rsync|runcon|scp|screen|sdiff|sed|select|seq|set|sftp|(sha1|sha224|sha256|sha384|sha512)sum|shift|shopt|shred|shuf|shutdown|sleep|sort|source|split|ssh|stat|stdbuf|strace|stty|su|sudo|sum|symlink|sync|tac|tail|tar|tee|test|time|timeout|times|top|touch|tr|traceroute|trap|true|truncate|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unlink|unset|unshar|useradd|usermod|users|uudecode|uuencode|v|vdir|vi|watch|wc|wget|whereis|which|who|whoami|xargs|yes

for some reason, i can't get the right colors even in 256 mode :-/ i blame my terminals.

here is a small bug with the syntax highlighting i saw:

screenshot_2017-12-30_12-50-09

it seems that after the first single-mark quote, anything that comes afterwards is interpreted differently, even the # comment character. then, the second single-mark quote is interpreted "correctly" (red arrow), and everything after that is interpreted as another quote.

thanks again!

tommyshem commented 6 years ago

Change the comment code to below from the sh.yaml file and it should cure it.

 - comment:
        start: "#"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

(Note I have removed (^|[[:space:]]) from the comment start: and left "#" in.)

tulakalbeyo commented 6 years ago

@tommyshem

it worked!! thank you so much!! and please reconsider my beer offer.. i will be at Southern California Linux Expo (SCALE) this coming march, btw.

ebrensi commented 2 years ago

I just discovered this cobalt colorscheme and it's great! I think it should be included as a default.