From bb246781579b3a0abbbd8578d84acf60fe3475b4 Mon Sep 17 00:00:00 2001 From: Reed Esau Date: Wed, 20 Aug 2014 23:01:29 -0600 Subject: [PATCH] Support very subtle background for code blocks and inline Inspired by how code appears in the markdown at github. --- README.markdown | 8 ++++++++ colors/pencil.vim | 31 +++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/README.markdown b/README.markdown index 32c5497..d747e9b 100644 --- a/README.markdown +++ b/README.markdown @@ -62,6 +62,14 @@ If you’re looking for neutral heading colors, set the following in your let g:pencil_neutral_headings = 1 " 0=blue (def), 1=normal ``` +### Markdown Code background + +If you’re looking for contrast in the code background in markdown: + +``` +let g:pencil_markdown_code_bg = 0 " 0=none (def), 1=subtle +``` + ### Airline Theme ![airline-example](http://i.imgur.com/V39pwZq.png) diff --git a/colors/pencil.vim b/colors/pencil.vim index 03b482b..7667cda 100644 --- a/colors/pencil.vim +++ b/colors/pencil.vim @@ -45,6 +45,10 @@ if ! exists("g:pencil_neutral_headings") let g:pencil_neutral_headings = 0 endif +if ! exists("g:pencil_markdown_code_bg") + let g:pencil_markdown_code_bg = 0 +endif + " Colors let s:black = { "gui": "#212121", "cterm": "0" } let s:medium_gray = { "gui": "#767676", "cterm": "243" } @@ -261,7 +265,6 @@ call s:h("htmlLink", {"fg": s:blue, "gui": "underline", "cterm": "underline " tpope/vim-markdown call s:h("markdownBlockquote", {"fg": s:norm}) -call s:h("markdownCodeDelimiter", {"fg": s:norm}) call s:h("markdownH1", {"fg": s:head_a, "gui": "bold,italic"}) call s:h("markdownH2", {"fg": s:head_a, "gui": "bold"}) call s:h("markdownH3", {"fg": s:head_a, "gui": "italic"}) @@ -282,13 +285,18 @@ call s:h("markdownUrl", {"fg": s:medium_gray, "gui": "underline" call s:h("markdownUrlDelimiter", {"fg": s:medium_gray}) call s:h("markdownUrlTitle", {"fg": s:norm}) call s:h("markdownUrlTitleDelimiter", {"fg": s:medium_gray}) +if g:pencil_markdown_code_bg == 1 + call s:h("markdownCode", {"fg": s:norm, "bg": s:bg_very_subtle}) + call s:h("markdownCodeDelimiter", {"fg": s:norm, "bg": s:bg_very_subtle}) +else + call s:h("markdownCode", {"fg": s:norm}) + call s:h("markdownCodeDelimiter", {"fg": s:norm}) +en " plasticboy/vim-markdown call s:h("mkdBlockQuote", {"fg": s:norm}) -call s:h("mkdCode", {"fg": s:norm}) call s:h("mkdDelimiter", {"fg": s:medium_gray}) call s:h("mkdID", {"fg": s:medium_gray}) -call s:h("mkdIndentCode", {"fg": s:norm}) call s:h("mkdLineContinue", {"fg": s:norm}) call s:h("mkdLink", {"fg": s:norm}) call s:h("mkdLinkDef", {"fg": s:medium_gray}) @@ -296,12 +304,16 @@ call s:h("mkdListItem", {"fg": s:norm}) call s:h("mkdNonListItemBlock", {"fg": s:norm}) " bug in syntax? call s:h("mkdRule", {"fg": s:norm}) call s:h("mkdUrl", {"fg": s:medium_gray, "gui": "underline", "cterm": "underline"}) +if g:pencil_markdown_code_bg == 1 + call s:h("mkdCode", {"fg": s:norm, "bg": s:bg_very_subtle}) + call s:h("mkdIndentCode", {"fg": s:norm, "bg": s:bg_very_subtle}) +else + call s:h("mkdCode", {"fg": s:norm}) + call s:h("mkdIndentCode", {"fg": s:norm}) +en " gabrielelana/vim-markdown -call s:h("markdownBlockquote", {"fg": s:norm}) call s:h("markdownBlockquoteDelimiter", {"fg": s:norm}) -call s:h("markdownFencedCodeBlock", {"fg": s:norm}) -call s:h("markdownInlineCode", {"fg": s:norm}) call s:h("markdownInlineDelimiter", {"fg": s:norm}) call s:h("markdownItemDelimiter", {"fg": s:norm}) call s:h("markdownLinkReference", {"fg": s:medium_gray}) @@ -309,6 +321,13 @@ call s:h("markdownLinkText", {"fg": s:norm}) call s:h("markdownLinkTextContainer", {"fg": s:medium_gray}) call s:h("markdownLinkUrl", {"fg": s:medium_gray, "gui": "underline", "cterm": "underline"}) call s:h("markdownLinkUrlContainer", {"fg": s:medium_gray}) +if g:pencil_markdown_code_bg == 1 + call s:h("markdownFencedCodeBlock", {"fg": s:norm, "bg": s:bg_very_subtle}) + call s:h("markdownInlineCode", {"fg": s:norm, "bg": s:bg_very_subtle}) +else + call s:h("markdownFencedCodeBlock", {"fg": s:norm}) + call s:h("markdownInlineCode", {"fg": s:norm}) +en " XML content hi! link xmlTag htmlTag