Browse Source

theme: theme palette file could specify mdhl and css files

Le Tan 8 years ago
parent
commit
7b4117c737
44 changed files with 892 additions and 2977 deletions
  1. 0 7
      src/resources/icons/add_style.svg
  2. 0 123
      src/resources/styles/solarized-dark.mdhl
  3. 0 124
      src/resources/styles/solarized-light.mdhl
  4. 237 0
      src/resources/themes/v_pure/v_pure.css
  5. 174 0
      src/resources/themes/v_pure/v_pure.mdhl
  6. 3 0
      src/resources/themes/v_pure/v_pure.palette
  7. 0 0
      src/resources/themes/v_pure/v_pure_codeblock.css
  8. 0 0
      src/resources/themes/v_white/v_white.css
  9. 2 2
      src/resources/themes/v_white/v_white.mdhl
  10. 3 0
      src/resources/themes/v_white/v_white.palette
  11. 0 0
      src/resources/themes/v_white/v_white_codeblock.css
  12. 9 8
      src/resources/vnote.ini
  13. 0 302
      src/resources/vnote.qss
  14. 0 66
      src/utils/highlightjs/styles/androidstudio.css
  15. 0 96
      src/utils/highlightjs/styles/atom-one-dark.css
  16. 0 77
      src/utils/highlightjs/styles/darcula.css
  17. 0 63
      src/utils/highlightjs/styles/dark.css
  18. 0 6
      src/utils/highlightjs/styles/darkula.css
  19. 0 99
      src/utils/highlightjs/styles/default.css
  20. 0 71
      src/utils/highlightjs/styles/github-gist.css
  21. 0 99
      src/utils/highlightjs/styles/github.css
  22. 0 89
      src/utils/highlightjs/styles/googlecode.css
  23. 0 108
      src/utils/highlightjs/styles/gruvbox-dark.css
  24. 0 108
      src/utils/highlightjs/styles/gruvbox-light.css
  25. 0 83
      src/utils/highlightjs/styles/monokai-sublime.css
  26. 0 70
      src/utils/highlightjs/styles/monokai.css
  27. 0 83
      src/utils/highlightjs/styles/qtcreator_dark.css
  28. 0 83
      src/utils/highlightjs/styles/qtcreator_light.css
  29. 0 85
      src/utils/highlightjs/styles/rainbow.css
  30. 0 84
      src/utils/highlightjs/styles/solarized-dark.css
  31. 0 84
      src/utils/highlightjs/styles/solarized-light.css
  32. 0 75
      src/utils/highlightjs/styles/tomorrow-night-blue.css
  33. 0 74
      src/utils/highlightjs/styles/tomorrow-night-bright.css
  34. 0 74
      src/utils/highlightjs/styles/tomorrow-night-eighties.css
  35. 0 75
      src/utils/highlightjs/styles/tomorrow-night.css
  36. 0 72
      src/utils/highlightjs/styles/tomorrow.css
  37. 144 267
      src/vconfigmanager.cpp
  38. 112 87
      src/vconfigmanager.h
  39. 59 166
      src/vmainwindow.cpp
  40. 0 17
      src/vmainwindow.h
  41. 2 2
      src/vnote.cpp
  42. 6 31
      src/vnote.qrc
  43. 98 14
      src/vpalette.cpp
  44. 43 3
      src/vpalette.h

+ 0 - 7
src/resources/icons/add_style.svg

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
-	 width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
-<polygon style="fill:#000000" points="448,224 288,224 288,64 224,64 224,224 64,224 64,288 224,288 224,448 288,448 288,288 448,288 "/>
-</svg>

+ 0 - 123
src/resources/styles/solarized-dark.mdhl

@@ -1,123 +0,0 @@
-# Styles using 'Solarized' color scheme
-# by Ethan Schoonover: http://ethanschoonover.com/solarized
-#
-# (dark background version)
-
-editor
-foreground: 93a1a1 # base1
-background: 002b36 # base03
-caret: ffffff
-font-size: 12
-
-editor-current-line
-background: 37474f
-vim-insert-background: 004d40
-vim-normal-background: 004d40
-vim-visual-background: 004d40
-vim-replace-background: 004d40
-
-H1
-foreground: 6c71c4 # violet
-font-style: bold
-
-H2
-foreground: 6c71c4 # violet
-font-style: bold
-
-H3
-foreground: 6c71c4 # violet
-
-H4
-foreground: 268bd2 # blue
-
-H5
-foreground: 268bd2 # blue
-
-H6
-foreground: 268bd2 # blue
-
-HRULE
-foreground: 586e75 # base01
-
-LIST_BULLET
-foreground: b58900 # yellow
-
-LIST_ENUMERATOR
-foreground: b58900 # yellow
-
-LINK
-foreground: 2aa198 # cyan
-
-AUTO_LINK_URL
-foreground: 2aa198 # cyan
-
-AUTO_LINK_EMAIL
-foreground: 2aa198 # cyan
-
-IMAGE
-foreground: d33682 # magenta
-
-REFERENCE
-foreground: 80b58900 # yellow, reduced alpha
-
-CODE
-foreground: 859900 # green
-
-EMPH
-foreground: cb4b16 # orange
-font-style: italic
-
-STRONG
-foreground: dc322f # red
-font-style: bold
-
-HTML_ENTITY
-foreground: 6c71c4 # violet
-
-COMMENT
-foreground: 93a1a1 # base1
-
-VERBATIM
-foreground: 859900 # green
-font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
-# Codeblock sylte from HighlightJS (bold, italic, underlined, color)
-# The last occurence of the same attribute takes effect
-hljs-comment: 888888
-hljs-keyword: bold
-hljs-attribute: bold
-hljs-selector-tag: bold
-hljs-meta-keyword: bold
-hljs-doctag: bold
-hljs-name: bold
-hljs-type: bf360c
-hljs-string: bf360c
-hljs-number: bf360c
-hljs-selector-id: bf360c
-hljs-selector-class: bf360c
-hljs-quote: bf360c
-hljs-template-tag: bf360c
-hljs-deletion: bf360c
-hljs-title: bold, bf360c
-hljs-section: bold, bf360c
-hljs-regexp: bc6060
-hljs-symbol: bc6060
-hljs-variable: bc6060
-hljs-template-variable: bc6060
-hljs-link: bc6060
-hljs-selector-attr: bc6060
-hljs-selector-pseudo: bc6060
-hljs-literal: 78a960
-hljs-built_in: 397300
-hljs-bullet: 397300
-hljs-code: 397300
-hljs-addition: 397300
-hljs-meta: 1f7199
-hljs-meta-string: 4d99bf
-hljs-emphasis: italic
-hljs-strong: bold
-
-BLOCKQUOTE
-foreground: d33682 # magenta
-
-STRIKE
-strike-color: 93a1a1 # base1

+ 0 - 124
src/resources/styles/solarized-light.mdhl

@@ -1,124 +0,0 @@
-# Styles using 'Solarized' color scheme
-# by Ethan Schoonover: http://ethanschoonover.com/solarized
-#
-# (light background version)
-
-editor
-foreground: 586e75 # base01
-background: fdf6e3 # base3
-caret: 000000
-font-size: 12
-
-editor-current-line
-background: c5cae9
-vim-insert-background: a5d6a7
-vim-normal-background: a5d6a7
-vim-visual-background: a5d6a7
-vim-replace-background: a5d6a7
-
-H1
-foreground: 6c71c4 # violet
-font-style: bold
-
-H2
-foreground: 6c71c4 # violet
-font-style: bold
-
-H3
-foreground: 6c71c4 # violet
-
-H4
-foreground: 268bd2 # blue
-
-H5
-foreground: 268bd2 # blue
-
-H6
-foreground: 268bd2 # blue
-
-HRULE
-foreground: 586e75 # base01
-
-LIST_BULLET
-foreground: b58900 # yellow
-
-LIST_ENUMERATOR
-foreground: b58900 # yellow
-
-LINK
-foreground: 2aa198 # cyan
-
-AUTO_LINK_URL
-foreground: 2aa198 # cyan
-
-AUTO_LINK_EMAIL
-foreground: 2aa198 # cyan
-
-IMAGE
-foreground: d33682 # magenta
-
-REFERENCE
-foreground: 80b58900 # yellow, reduced alpha
-
-CODE
-foreground: 859900 # green
-
-EMPH
-foreground: cb4b16 # orange
-font-style: italic
-
-STRONG
-foreground: dc322f # red
-font-style: bold
-
-HTML_ENTITY
-foreground: 6c71c4 # violet
-
-COMMENT
-foreground: 93a1a1 # base1
-
-VERBATIM
-foreground: 859900 # green
-font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
-# Codeblock sylte from HighlightJS (bold, italic, underlined, color)
-# The last occurence of the same attribute takes effect
-hljs-comment: 888888
-hljs-keyword: bold
-hljs-attribute: bold
-hljs-selector-tag: bold
-hljs-meta-keyword: bold
-hljs-doctag: bold
-hljs-name: bold
-hljs-type: 880000
-hljs-string: 880000
-hljs-number: 880000
-hljs-selector-id: 880000
-hljs-selector-class: 880000
-hljs-quote: 880000
-hljs-template-tag: 880000
-hljs-deletion: 880000
-hljs-title: bold, 880000
-hljs-section: bold, 880000
-hljs-regexp: bc6060
-hljs-symbol: bc6060
-hljs-variable: bc6060
-hljs-template-variable: bc6060
-hljs-link: bc6060
-hljs-selector-attr: bc6060
-hljs-selector-pseudo: bc6060
-hljs-literal: 78a960
-hljs-built_in: 397300
-hljs-bullet: 397300
-hljs-code: 397300
-hljs-addition: 397300
-hljs-meta: 1f7199
-hljs-meta-string: 4d99bf
-hljs-emphasis: italic
-hljs-strong: bold
-
-BLOCKQUOTE
-foreground: d33682 # magenta
-
-STRIKE
-strike-color: 586e75 # base01
-

+ 237 - 0
src/resources/themes/v_pure/v_pure.css

@@ -0,0 +1,237 @@
+body {
+    margin: 0 auto;
+    font-family: Helvetica, sans-serif, Tahoma, Arial, Verdana, Geneva, Georgia, Palatino, "Times New Roman", "Hiragino Sans GB", "冬青黑体", "Microsoft YaHei", "微软雅黑", "Microsoft YaHei UI", "WenQuanYi Micro Hei", "文泉驿雅黑", Dengxian, "等线体", STXihei, "华文细黑", "Liberation Sans", "Droid Sans", NSimSun, "新宋体", SimSun, "宋体";
+    color: #363636;
+    line-height: 1;
+    padding: 30px;
+    background: #F5F5F5;
+}
+
+h1, h2, h3, h4, h5, h6 {
+    color: #363636;
+    font-weight: bold;
+    margin-bottom: 24px;
+    padding: 0;
+}
+
+p {
+    padding: 0;
+}
+
+h1 {
+    font-size: 36px;
+}
+
+h2 {
+    font-size: 30px;
+}
+
+h3 {
+    font-size: 26px;
+}
+
+h4 {
+    font-size: 22px;
+}
+
+h5 {
+    font-size: 20px;
+}
+
+h6 {
+    font-size: 18px;
+}
+
+a {
+    color: #0099ff;
+    margin: 0;
+    padding: 0;
+    vertical-align: baseline;
+}
+
+a:hover {
+    text-decoration: none;
+    color: #ff6600;
+}
+
+a:visited {
+    color: purple;
+}
+
+ul, ol {
+    padding: 0;
+    padding-left: 24px;
+}
+
+li {
+    line-height: 24px;
+}
+
+li ul, li ul {
+    margin-left: 24px;
+}
+
+p, ul, ol {
+    font-size: 16px;
+    line-height: 24px;
+}
+
+pre {
+    background-color: #f8f8f8;
+    border-radius: 3px;
+    border: 1px solid #cccccc;
+    overflow: auto;
+}
+
+code {
+    font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New;
+    line-height: 1.5;
+    font-size: 14px;
+    color: #4527A0;
+}
+
+pre code {
+    margin: 0;
+    padding: 0;
+    border: none;
+    background: transparent;
+    overflow: auto;
+    color: #363636;
+}
+
+aside {
+    display: block;
+    float: right;
+    width: 390px;
+}
+
+blockquote {
+    border-left:.5em solid #7a7a7a;
+    padding: 0 2em;
+    margin-left:0;
+}
+
+blockquote  cite {
+    font-size:14px;
+    line-height:20px;
+    color:#bfbfbf;
+}
+
+blockquote cite:before {
+    content: '\2014 \00A0';
+}
+
+blockquote p {
+    color: #666;
+}
+
+hr {
+    text-align: left;
+    margin: 1em 0;
+    color: #999;
+}
+
+table {
+   padding: 0;
+   border-collapse: collapse;
+}
+
+table tr {
+   border-top: 1px solid #cccccc;
+   background-color: white;
+   margin: 0;
+   padding: 0;
+}
+
+table tr:nth-child(2n) {
+   background-color: #f8f8f8;
+}
+
+table tr th {
+   font-weight: bold;
+   border: 1px solid #cccccc;
+   margin: 0;
+   padding: 6px 13px;
+}
+
+table tr td {
+   border: 1px solid #cccccc;
+   margin: 0;
+   padding: 6px 13px;
+}
+
+table tr th :first-child, table tr td :first-child {
+   margin-top: 0;
+}
+
+table tr th :last-child, table tr td :last-child {
+   margin-bottom: 0;
+}
+
+div.mermaid-diagram {
+    overflow-y: hidden;
+}
+
+pre.mermaid-diagram {
+    overflow-y: hidden;
+}
+
+div.flowchart-diagram {
+    overflow-y: hidden;
+}
+
+pre.flowchart-diagram {
+    overflow-y: hidden;
+}
+
+.img-package {
+    text-align: center;
+}
+
+img.img-center {
+    display: block;
+    margin-left: auto;
+    margin-right: auto;
+}
+
+div.img-caption {
+    min-width: 20%;
+    max-width: 80%;
+    display: inline-block;
+    padding: 10px;
+    margin: 0 auto;
+    border-bottom: 1px solid #c0c0c0;
+    color: #6c6c6c;
+    text-align: center;
+    line-height: 1.5;
+}
+
+/* For Highlight.js Line Number */
+table.hljs-ln tr {
+    border: none;
+    background-color: transparent;
+}
+
+table.hljs-ln tr td {
+    border: none;
+    background-color: transparent;
+}
+
+table.hljs-ln tr td.hljs-ln-numbers {
+	-webkit-touch-callout: none;
+	-webkit-user-select: none;
+	-khtml-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+
+	text-align: center;
+	color: #AAA;
+	border-right: 1px solid #CCC;
+	vertical-align: top;
+	padding-right: 5px;
+}
+
+table.hljs-ln tr td.hljs-ln-code {
+	padding-left: 10px;
+}

+ 174 - 0
src/resources/themes/v_pure/v_pure.mdhl

@@ -0,0 +1,174 @@
+# This is the default markdown styles used for Peg-Markdown-Highlight
+# created by Le Tan([email protected]).
+# For a complete description of the syntax, please refer to the original
+# documentation of the style parser
+# [The Syntax of PEG Markdown Highlight Stylesheets](http://hasseg.org/peg-markdown-highlight/docs/stylesheet_syntax.html).
+# VNote adds some styles in the syntax which will be marked [VNote] in the comment.
+#
+# Note: Empty lines within a section is NOT allowed.
+# Note: Do NOT modify this file directly. Copy it and tune your own style!
+
+editor
+# QTextEdit just choose the first available font, so specify the Chinese fonts first
+# Do not use "" to quote the name
+font-family: Hiragino Sans GB, 冬青黑体, Microsoft YaHei, 微软雅黑, Microsoft YaHei UI, WenQuanYi Micro Hei, 文泉驿雅黑, Dengxian, 等线体, STXihei, 华文细黑, Liberation Sans, Droid Sans, NSimSun, 新宋体, SimSun, 宋体, Helvetica, sans-serif, Tahoma, Arial, Verdana, Geneva, Georgia, Times New Roman
+font-size: 12
+foreground: 222222
+background: f5f5f5
+# [VNote] Style for trailing space
+trailing-space: a8a8a8
+# [VNote] Style for line number
+line-number-background: eaeaea
+line-number-foreground: 424242
+# [VNote] Style for selected word highlight
+selected-word-background: dfdf00
+# [VNote] Style for searched word highlight
+searched-word-background: 4db6ac
+# [VNote] Style for searched word under cursor highlight
+searched-word-cursor-background: 66bb6a
+# [VNote] Style for incremental searched word highlight
+incremental-searched-word-background: ce93d8
+# [VNote] Style for color column in fenced code block
+color-column-background: dd0000
+color-column-foreground: ffff00
+# [VNote} Style for preview image line
+preview-image-line-foreground: 9575cd
+
+editor-selection
+foreground: eeeeee
+background: 005fff
+
+editor-current-line
+background: c5cae9
+# [VNote] Vim insert mode cursor line background
+vim-insert-background: c5cae9
+# [VNote] Vim normal mode cursor line background
+vim-normal-background: bdbdbd
+# [VNote] Vim visual mode cursor line background
+vim-visual-background: 90caf9
+# [VNote] Vim replace mode cursor line background
+vim-replace-background: f8bbd0
+
+H1
+foreground: 222222
+font-style: bold
+font-size: +8
+
+H2
+foreground: 222222
+font-style: bold
+font-size: +6
+
+H3
+foreground: 222222
+font-style: bold
+font-size: +4
+
+H4
+foreground: 222222
+font-style: bold
+font-size: +2
+
+H5
+foreground: 222222
+font-style: bold
+font-size: +2
+
+H6
+foreground: 222222
+font-style: bold
+font-size: +2
+
+HRULE
+foreground: 586e75
+
+LIST_BULLET
+foreground: d33682
+font-style: bold
+font-size: +2
+
+LIST_ENUMERATOR
+foreground: 0000ff
+
+LINK
+foreground: 005fff
+font-style: underlined
+
+AUTO_LINK_URL
+foreground: 005fff
+font-style: underlined
+
+AUTO_LINK_EMAIL
+foreground: 005fff
+font-style: underlined
+
+IMAGE
+foreground: 616161
+
+REFERENCE
+foreground: b58900
+
+CODE
+foreground: 551a8b
+font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
+
+EMPH
+font-style: italic
+
+STRONG
+font-style: bold
+
+HTML_ENTITY
+foreground: 6c71c4
+
+COMMENT
+foreground: 93a1a1
+
+VERBATIM
+foreground: 551a8b
+font-family: Consolas, Monaco, Andale Mono, Monospace, Courier New
+# [VNote] Codeblock sylte from HighlightJS (bold, italic, underlined, color)
+# The last occurence of the same attribute takes effect
+# Could specify multiple attribute in one line
+hljs-comment: italic, 898989
+hljs-quote: italic, 898989
+hljs-doctag: a626a4
+hljs-keyword: a626a4
+hljs-formula: a626a4
+hljs-section: e45649
+hljs-name: e45649
+hljs-selector-tag: e45649
+hljs-deletion: e45649
+hljs-subst: e45649
+hljs-literal: 0184bb
+hljs-string: 50a1f4
+hljs-regexp: 50a1f4
+hljs-addition: 50a1f4
+hljs-attribute: 50a1f4
+hljs-meta-string: 50a1f4
+hljs-built_in: c18401
+hljs-attr: 986801
+hljs-variable: 986801
+hljs-template-variable: 986801
+hljs-type: 986801
+hljs-selector-class: 986801
+hljs-selector-attr: 986801
+hljs-selector-pseudo: 986801
+hljs-number: 986801
+hljs-symbol: 4078f2
+hljs-bullet: 4078f2
+hljs-link: underlined, 4078f2
+hljs-meta: 4078f2
+hljs-selector-id: 4078f2
+hljs-title: 4078f2
+hljs-emphasis: italic
+hljs-strong: bold
+hljs-meta-keyword: 0000ee
+hljs-template-tag: 880000
+hljs-code: 008700
+
+BLOCKQUOTE
+foreground: 00af00
+
+STRIKE
+strike-color: 586e75

+ 3 - 0
src/resources/themes/v_pure/v_pure.palette

@@ -3,6 +3,9 @@
 
 [metadata]
 qss_file=v_pure.qss
+mdhl_file=v_pure.mdhl
+css_file=v_pure.css
+codeblock_css_file=v_pure_codeblock.css
 
 [phony]
 ; Abstract color attributes.

+ 0 - 0
src/utils/highlightjs/styles/atom-one-light.css → src/resources/themes/v_pure/v_pure_codeblock.css


+ 0 - 0
src/resources/styles/default.css → src/resources/themes/v_white/v_white.css


+ 2 - 2
src/resources/styles/default.mdhl → src/resources/themes/v_white/v_white.mdhl

@@ -17,7 +17,7 @@ foreground: 363636
 # [VNote] Style for trailing space
 trailing-space: a8a8a8
 # [VNote] Style for line number
-line-number-background: bdbdbd
+line-number-background: f5f5f5
 line-number-foreground: 424242
 # [VNote] Style for selected word highlight
 selected-word-background: dfdf00
@@ -42,7 +42,7 @@ background: c5cae9
 # [VNote] Vim insert mode cursor line background
 vim-insert-background: c5cae9
 # [VNote] Vim normal mode cursor line background
-vim-normal-background: bcbcbc
+vim-normal-background: c0c0c0
 # [VNote] Vim visual mode cursor line background
 vim-visual-background: 90caf9
 # [VNote] Vim replace mode cursor line background

+ 3 - 0
src/resources/themes/v_white/v_white.palette

@@ -3,6 +3,9 @@
 
 [metadata]
 qss_file=v_white.qss
+mdhl_file=v_white.mdhl
+css_file=v_white.css
+codeblock_css_file=v_white_codeblock.css
 
 [phony]
 ; Abstract color attributes.

+ 0 - 0
src/utils/highlightjs/styles/vnote.css → src/resources/themes/v_white/v_white_codeblock.css


+ 9 - 8
src/resources/vnote.ini

@@ -1,20 +1,21 @@
 [global]
 ; Theme name
-theme=v_white
+theme=v_pure
 
 welcome_page_path=:/resources/welcome.html
 
-; CSS style for Markdown template
-template_css=default
+; CSS style name for Markdown template
+; Empty to use theme's css style
+css_style=
 
 ; Code block CSS style for Markdown template
-template_code_block_css=vnote
+; Empty to use theme's css style
+code_block_css_style=
 
-; Code block CSS style file URL for Markdown template
-; If not empty, VNote will ignore template_code_block_css
-template_code_block_css_url=
+; Editor style name
+; Empty to use theme's editor style
+editor_style=
 
-editor_style=default
 current_notebook=0
 tab_stop_width=4
 is_expand_tab=true

+ 0 - 302
src/resources/vnote.qss

@@ -1,302 +0,0 @@
-QPushButton[CornerBtn="true"] {
-    padding: 4px -2px 4px -2px;
-    margin: 0px;
-    border: none;
-    background-color: transparent;
-}
-
-QPushButton[CornerBtn="true"]::menu-indicator {
-    image: none;
-}
-
-QPushButton[CornerBtn="true"]:hover {
-    background-color: @hover-color;
-}
-
-QPushButton[CornerBtn="true"]:focus {
-    background-color: @focus-color;
-}
-
-QPushButton[StatusBtn="true"] {
-    font: bold;
-    padding: 0px 2px 0px 2px;
-    margin: 0px;
-    border: none;
-    background-color: transparent;
-}
-
-QPushButton[StatusBtn="true"]:hover {
-    background-color: @hover-color;
-}
-
-QPushButton[StatusBtn="true"]:focus {
-    background-color: @focus-color;
-}
-
-QPushButton[FlatBtn="true"] {
-    padding: 4px;
-    margin: 0px;
-    border: none;
-    background-color: transparent;
-}
-
-QPushButton[FlatBtn="true"]:hover {
-    background-color: @hover-color;
-}
-
-QPushButton[FlatBtn="true"]:focus {
-    background-color: @focus-color;
-}
-
-QPushButton[SelectionBtn="true"] {
-    padding: 4px 10px 4px 10px;
-    border: none;
-    background-color: transparent;
-    font-size: 15pt;
-    text-align: left;
-}
-
-QPushButton[SelectionBtn="true"]:hover {
-    background-color: @hover-color;
-}
-
-QPushButton[SelectionBtn="true"]:focus {
-    background-color: @focus-color;
-}
-
-QPushButton[TitleBtn="true"] {
-    padding: 4px;
-    margin: 0px;
-    border: none;
-    background-color: @base-color;
-}
-
-QPushButton[TitleBtn="true"]:hover {
-    background-color: @hover-color;
-}
-
-QPushButton[TitleBtn="true"]:focus {
-    background-color: @focus-color;
-}
-
-QPushButton[DangerBtn="true"] {
-    color: #fff;
-    border-color: #d43f3a;
-    background-color: #d9534f;
-}
-
-QPushButton[DangerBtn="true"]:hover {
-    color: #fff;
-    border-color: #ac2925;
-    background-color: #c9302c;
-}
-
-QToolBar {
-    border: none;
-}
-
-QToolButton:hover {
-    background-color: @hover-color;
-}
-
-/* Override default shift behavior */
-QToolButton::menu-arrow:open {
-}
-
-QMenuBar {
-    border: none;
-}
-
-QMenuBar::item:selected {
-    background-color: @hover-color;
-}
-
-/* DockWidget */
-QDockWidget {
-    titlebar-close-icon: url(:/resources/icons/close.svg);
-    titlebar-normal-icon: url(:/resources/icons/float.svg);
-}
-
-QDockWidget::Title {
-    background: @base-color;
-    text-align: center left;
-}
-
-QDockWidget::close-button, QDockWidget::float-button {
-    border: none;
-}
-
-QDockWidget::close-button:hover, QDockWidget::float-button:hover {
-    background-color: @hover-color;
-}
-
-QDockWidget::close-button:focus, QDockWidget::float-button:focus {
-    background-color: @focus-color;
-}
-/* End DockWidget */
-
-/* QComboBox#NotebookSelector */
-QComboBox#NotebookSelector {
-    border: none;
-    background-color: @base-background;
-    font-size: 13pt;
-    padding-top: 3px;
-    padding-bottom: 3px;
-    icon-size: 30px;
-}
-
-QComboBox#NotebookSelector:focus {
-    background-color: @focus-color;
-}
-
-QComboBox#NotebookSelector::drop-down {
-    subcontrol-origin: padding;
-    subcontrol-position: top right;
-    width: 20px;
-    border: none;
-    background: transparent;
-}
-
-QComboBox#NotebookSelector::down-arrow {
-    image: url(:/resources/icons/arrow_dropdown.svg);
-    width: 20px;
-    height: 20px;
-}
-
-QComboBox#NotebookSelector QListWidget {
-    border: 1px solid grey;
-    background-color: @base-background;
-    font-size: 13pt;
-    icon-size: 30px;
-}
-
-QComboBox#NotebookSelector QListWidget::item {
-    padding-top: 10px;
-    padding-bottom: 10px;
-}
-
-QComboBox#NotebookSelector QListWidget::item:hover {
-    background-color: @hover-color;
-}
-/* End QComboBox#NotebookSelector */
-
-QTreeWidget {
-    padding-top: 3px;
-    border: none;
-}
-
-QTreeWidget::item {
-    padding-top: 5px;
-    padding-bottom: 5px;
-}
-
-QListWidget {
-    border: none;
-}
-
-QListWidget::item {
-    padding-top: 5px;
-    padding-bottom: 5px;
-}
-
-QSplitter {
-    border: none;
-}
-
-QSplitter::handle {
-    background-color: @base-color;
-}
-
-QSplitter::handle:vertical {
-    height: 2px;
-}
-
-QSplitter#MainSplitter {
-    border-top: 2px solid @base-color;
-}
-
-/* QMainWindow */
-QMainWindow::separator {
-    background-color: @base-color;
-    height: 2px;
-}
-/* End QMainWindow */
-
-QTabWidget {
-    border: none;
-}
-
-QLabel[TitleLabel="true"] {
-    padding-top: 3px;
-    padding-bottom: 3px;
-    background-color: @base-color;
-}
-
-QLabel[ColorRedLabel="true"] {
-    padding-left: 3px;
-    padding-right: 3px;
-    font: bold;
-    color: white;
-    border-radius: 2px;
-    background-color: @Red7;
-}
-
-QLabel[ColorGreenLabel="true"] {
-    padding-left: 3px;
-    padding-right: 3px;
-    font: bold;
-    color: white;
-    border-radius: 2px;
-    background-color: @Green7;
-}
-
-QLabel[ColorGreyLabel="true"] {
-    padding-left: 3px;
-    padding-right: 3px;
-    font: bold;
-    color: white;
-    border-radius: 2px;
-    background-color: @Grey7;
-}
-
-QLabel[ColorTealLabel="true"] {
-    padding-left: 3px;
-    padding-right: 3px;
-    font: bold;
-    color: white;
-    border-radius: 2px;
-    background-color: @Teal7;
-}
-
-VSelectorItemWidget QLabel[SelectorItemShortcutLabel="true"] {
-    font: bold;
-    border: 2px solid @logo-min;
-    padding: 3px;
-    border-radius: 5px;
-    background-color: @logo-base;
-    color: @logo-max;
-}
-
-QWidget[NotebookPanel="true"] {
-    padding-left: 3px;
-}
-
-QTabBar::close-button {
-    image: url(:/resources/icons/close_grey.svg);
-}
-
-QTabBar::close-button:hover {
-    image: url(:/resources/icons/close.svg);
-    background-color: @hover-color;
-}
-
-QTabBar::close-button:focus {
-    image: url(:/resources/icons/close.svg);
-    background-color: @focus-color;
-}
-
-QLineEdit[VimCommandLine="true"] {
-    padding: 0px;
-    margin: 0px;
-    border: none;
-}

+ 0 - 66
src/utils/highlightjs/styles/androidstudio.css

@@ -1,66 +0,0 @@
-/*
-Date: 24 Fev 2015
-Author: Pedro Oliveira <kanytu@gmail . com>
-*/
-
-.hljs {
-  color: #a9b7c6;
-  background: #282b2e;
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-}
-
-.hljs-number,
-.hljs-literal,
-.hljs-symbol,
-.hljs-bullet {
-  color: #6897BB;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-deletion {
-  color: #cc7832;
-}
-
-.hljs-variable,
-.hljs-template-variable,
-.hljs-link {
-  color: #629755;
-}
-
-.hljs-comment,
-.hljs-quote {
-  color: #808080;
-}
-
-.hljs-meta {
-  color: #bbb529;
-}
-
-.hljs-string,
-.hljs-attribute,
-.hljs-addition {
-  color: #6A8759;
-}
-
-.hljs-section,
-.hljs-title,
-.hljs-type {
-  color: #ffc66d;
-}
-
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class {
-  color: #e8bf6a;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 96
src/utils/highlightjs/styles/atom-one-dark.css

@@ -1,96 +0,0 @@
-/*
-
-Atom One Dark by Daniel Gamage
-Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
-
-base:    #282c34
-mono-1:  #abb2bf
-mono-2:  #818896
-mono-3:  #5c6370
-hue-1:   #56b6c2
-hue-2:   #61aeee
-hue-3:   #c678dd
-hue-4:   #98c379
-hue-5:   #e06c75
-hue-5-2: #be5046
-hue-6:   #d19a66
-hue-6-2: #e6c07b
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  color: #abb2bf;
-  background: #282c34;
-}
-
-.hljs-comment,
-.hljs-quote {
-  color: #5c6370;
-  font-style: italic;
-}
-
-.hljs-doctag,
-.hljs-keyword,
-.hljs-formula {
-  color: #c678dd;
-}
-
-.hljs-section,
-.hljs-name,
-.hljs-selector-tag,
-.hljs-deletion,
-.hljs-subst {
-  color: #e06c75;
-}
-
-.hljs-literal {
-  color: #56b6c2;
-}
-
-.hljs-string,
-.hljs-regexp,
-.hljs-addition,
-.hljs-attribute,
-.hljs-meta-string {
-  color: #98c379;
-}
-
-.hljs-built_in,
-.hljs-class .hljs-title {
-  color: #e6c07b;
-}
-
-.hljs-attr,
-.hljs-variable,
-.hljs-template-variable,
-.hljs-type,
-.hljs-selector-class,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-number {
-  color: #d19a66;
-}
-
-.hljs-symbol,
-.hljs-bullet,
-.hljs-link,
-.hljs-meta,
-.hljs-selector-id,
-.hljs-title {
-  color: #61aeee;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}
-
-.hljs-link {
-  text-decoration: underline;
-}

+ 0 - 77
src/utils/highlightjs/styles/darcula.css

@@ -1,77 +0,0 @@
-/*
-
-Darcula color scheme from the JetBrains family of IDEs
-
-*/
-
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #2b2b2b;
-}
-
-.hljs {
-  color: #bababa;
-}
-
-.hljs-strong,
-.hljs-emphasis {
-  color: #a8a8a2;
-}
-
-.hljs-bullet,
-.hljs-quote,
-.hljs-link,
-.hljs-number,
-.hljs-regexp,
-.hljs-literal {
-  color: #6896ba;
-}
-
-.hljs-code,
-.hljs-selector-class {
-  color: #a6e22e;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-section,
-.hljs-attribute,
-.hljs-name,
-.hljs-variable {
-  color: #cb7832;
-}
-
-.hljs-params {
-  color: #b9b9b9;
-}
-
-.hljs-string {
-  color: #6a8759;
-}
-
-.hljs-subst,
-.hljs-type,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-symbol,
-.hljs-selector-id,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-template-tag,
-.hljs-template-variable,
-.hljs-addition {
-  color: #e0c46c;
-}
-
-.hljs-comment,
-.hljs-deletion,
-.hljs-meta {
-  color: #7f7f7f;
-}

+ 0 - 63
src/utils/highlightjs/styles/dark.css

@@ -1,63 +0,0 @@
-/*
-
-Dark style from softwaremaniacs.org (c) Ivan Sagalaev <[email protected]>
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #444;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-literal,
-.hljs-section,
-.hljs-link {
-  color: white;
-}
-
-.hljs,
-.hljs-subst {
-  color: #ddd;
-}
-
-.hljs-string,
-.hljs-title,
-.hljs-name,
-.hljs-type,
-.hljs-attribute,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-built_in,
-.hljs-addition,
-.hljs-variable,
-.hljs-template-tag,
-.hljs-template-variable {
-  color: #d88;
-}
-
-.hljs-comment,
-.hljs-quote,
-.hljs-deletion,
-.hljs-meta {
-  color: #777;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-literal,
-.hljs-title,
-.hljs-section,
-.hljs-doctag,
-.hljs-type,
-.hljs-name,
-.hljs-strong {
-  font-weight: bold;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}

+ 0 - 6
src/utils/highlightjs/styles/darkula.css

@@ -1,6 +0,0 @@
-/*
-  Deprecated due to a typo in the name and left here for compatibility purpose only.
-  Please use darcula.css instead.
-*/
-
-@import url('darcula.css');

+ 0 - 99
src/utils/highlightjs/styles/default.css

@@ -1,99 +0,0 @@
-/*
-
-Original highlight.js style (c) Ivan Sagalaev <[email protected]>
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #F0F0F0;
-}
-
-
-/* Base color: saturation 0; */
-
-.hljs,
-.hljs-subst {
-  color: #444;
-}
-
-.hljs-comment {
-  color: #888888;
-}
-
-.hljs-keyword,
-.hljs-attribute,
-.hljs-selector-tag,
-.hljs-meta-keyword,
-.hljs-doctag,
-.hljs-name {
-  font-weight: bold;
-}
-
-
-/* User color: hue: 0 */
-
-.hljs-type,
-.hljs-string,
-.hljs-number,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-quote,
-.hljs-template-tag,
-.hljs-deletion {
-  color: #880000;
-}
-
-.hljs-title,
-.hljs-section {
-  color: #880000;
-  font-weight: bold;
-}
-
-.hljs-regexp,
-.hljs-symbol,
-.hljs-variable,
-.hljs-template-variable,
-.hljs-link,
-.hljs-selector-attr,
-.hljs-selector-pseudo {
-  color: #BC6060;
-}
-
-
-/* Language color: hue: 90; */
-
-.hljs-literal {
-  color: #78A960;
-}
-
-.hljs-built_in,
-.hljs-bullet,
-.hljs-code,
-.hljs-addition {
-  color: #397300;
-}
-
-
-/* Meta color: hue: 200 */
-
-.hljs-meta {
-  color: #1f7199;
-}
-
-.hljs-meta-string {
-  color: #4d99bf;
-}
-
-
-/* Misc effects */
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 71
src/utils/highlightjs/styles/github-gist.css

@@ -1,71 +0,0 @@
-/**
- * GitHub Gist Theme
- * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro
- */
-
-.hljs {
-  display: block;
-  background: white;
-  padding: 0.5em;
-  color: #333333;
-  overflow-x: auto;
-}
-
-.hljs-comment,
-.hljs-meta {
-  color: #969896;
-}
-
-.hljs-string,
-.hljs-variable,
-.hljs-template-variable,
-.hljs-strong,
-.hljs-emphasis,
-.hljs-quote {
-  color: #df5000;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-type {
-  color: #a71d5d;
-}
-
-.hljs-literal,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-attribute {
-  color: #0086b3;
-}
-
-.hljs-section,
-.hljs-name {
-  color: #63a35c;
-}
-
-.hljs-tag {
-  color: #333333;
-}
-
-.hljs-title,
-.hljs-attr,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-selector-attr,
-.hljs-selector-pseudo {
-  color: #795da3;
-}
-
-.hljs-addition {
-  color: #55a532;
-  background-color: #eaffea;
-}
-
-.hljs-deletion {
-  color: #bd2c00;
-  background-color: #ffecec;
-}
-
-.hljs-link {
-  text-decoration: underline;
-}

+ 0 - 99
src/utils/highlightjs/styles/github.css

@@ -1,99 +0,0 @@
-/*
-
-github.com style (c) Vasily Polovnyov <[email protected]>
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  color: #333;
-  background: #f8f8f8;
-}
-
-.hljs-comment,
-.hljs-quote {
-  color: #998;
-  font-style: italic;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-subst {
-  color: #333;
-  font-weight: bold;
-}
-
-.hljs-number,
-.hljs-literal,
-.hljs-variable,
-.hljs-template-variable,
-.hljs-tag .hljs-attr {
-  color: #008080;
-}
-
-.hljs-string,
-.hljs-doctag {
-  color: #d14;
-}
-
-.hljs-title,
-.hljs-section,
-.hljs-selector-id {
-  color: #900;
-  font-weight: bold;
-}
-
-.hljs-subst {
-  font-weight: normal;
-}
-
-.hljs-type,
-.hljs-class .hljs-title {
-  color: #458;
-  font-weight: bold;
-}
-
-.hljs-tag,
-.hljs-name,
-.hljs-attribute {
-  color: #000080;
-  font-weight: normal;
-}
-
-.hljs-regexp,
-.hljs-link {
-  color: #009926;
-}
-
-.hljs-symbol,
-.hljs-bullet {
-  color: #990073;
-}
-
-.hljs-built_in,
-.hljs-builtin-name {
-  color: #0086b3;
-}
-
-.hljs-meta {
-  color: #999;
-  font-weight: bold;
-}
-
-.hljs-deletion {
-  background: #fdd;
-}
-
-.hljs-addition {
-  background: #dfd;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 89
src/utils/highlightjs/styles/googlecode.css

@@ -1,89 +0,0 @@
-/*
-
-Google Code style (c) Aahan Krish <[email protected]>
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: white;
-  color: black;
-}
-
-.hljs-comment,
-.hljs-quote {
-  color: #800;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-section,
-.hljs-title,
-.hljs-name {
-  color: #008;
-}
-
-.hljs-variable,
-.hljs-template-variable {
-  color: #660;
-}
-
-.hljs-string,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-regexp {
-  color: #080;
-}
-
-.hljs-literal,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-meta,
-.hljs-number,
-.hljs-link {
-  color: #066;
-}
-
-.hljs-title,
-.hljs-doctag,
-.hljs-type,
-.hljs-attr,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-params {
-  color: #606;
-}
-
-.hljs-attribute,
-.hljs-subst {
-  color: #000;
-}
-
-.hljs-formula {
-  background-color: #eee;
-  font-style: italic;
-}
-
-.hljs-selector-id,
-.hljs-selector-class {
-  color: #9B703F
-}
-
-.hljs-addition {
-  background-color: #baeeba;
-}
-
-.hljs-deletion {
-  background-color: #ffc8bd;
-}
-
-.hljs-doctag,
-.hljs-strong {
-  font-weight: bold;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}

+ 0 - 108
src/utils/highlightjs/styles/gruvbox-dark.css

@@ -1,108 +0,0 @@
-/*
-
-Gruvbox style (dark) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox)
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #282828;
-}
-
-.hljs,
-.hljs-subst {
-  color: #ebdbb2;
-}
-
-/* Gruvbox Red */
-.hljs-deletion,
-.hljs-formula,
-.hljs-keyword,
-.hljs-link,
-.hljs-selector-tag {
-  color: #fb4934;
-}
-
-/* Gruvbox Blue */
-.hljs-built_in,
-.hljs-emphasis,
-.hljs-name,
-.hljs-quote,
-.hljs-strong,
-.hljs-title,
-.hljs-variable {
-  color: #83a598;
-}
-
-/* Gruvbox Yellow */
-.hljs-attr,
-.hljs-params,
-.hljs-template-tag,
-.hljs-type {
-  color: #fabd2f;
-}
-
-/* Gruvbox Purple */
-.hljs-builtin-name,
-.hljs-doctag,
-.hljs-literal,
-.hljs-number {
-  color: #8f3f71;
-}
-
-/* Gruvbox Orange */
-.hljs-code,
-.hljs-meta,
-.hljs-regexp,
-.hljs-selector-id,
-.hljs-template-variable {
-  color: #fe8019;
-}
-
-/* Gruvbox Green */
-.hljs-addition,
-.hljs-meta-string,
-.hljs-section,
-.hljs-selector-attr,
-.hljs-selector-class,
-.hljs-string,
-.hljs-symbol {
-  color: #b8bb26;
-}
-
-/* Gruvbox Aqua */
-.hljs-attribute,
-.hljs-bullet,
-.hljs-class,
-.hljs-function,
-.hljs-function .hljs-keyword,
-.hljs-meta-keyword,
-.hljs-selector-pseudo,
-.hljs-tag {
-  color: #8ec07c;
-}
-
-/* Gruvbox Gray */
-.hljs-comment {
-  color: #928374;
-}
-
-/* Gruvbox Purple */
-.hljs-link_label,
-.hljs-literal,
-.hljs-number {
-  color: #d3869b;
-}
-
-.hljs-comment,
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-section,
-.hljs-strong,
-.hljs-tag {
-  font-weight: bold;
-}

+ 0 - 108
src/utils/highlightjs/styles/gruvbox-light.css

@@ -1,108 +0,0 @@
-/*
-
-Gruvbox style (light) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox)
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #fbf1c7;
-}
-
-.hljs,
-.hljs-subst {
-  color: #3c3836;
-}
-
-/* Gruvbox Red */
-.hljs-deletion,
-.hljs-formula,
-.hljs-keyword,
-.hljs-link,
-.hljs-selector-tag {
-  color: #9d0006;
-}
-
-/* Gruvbox Blue */
-.hljs-built_in,
-.hljs-emphasis,
-.hljs-name,
-.hljs-quote,
-.hljs-strong,
-.hljs-title,
-.hljs-variable {
-  color: #076678;
-}
-
-/* Gruvbox Yellow */
-.hljs-attr,
-.hljs-params,
-.hljs-template-tag,
-.hljs-type {
-  color: #b57614;
-}
-
-/* Gruvbox Purple */
-.hljs-builtin-name,
-.hljs-doctag,
-.hljs-literal,
-.hljs-number {
-  color: #8f3f71;
-}
-
-/* Gruvbox Orange */
-.hljs-code,
-.hljs-meta,
-.hljs-regexp,
-.hljs-selector-id,
-.hljs-template-variable {
-  color: #af3a03;
-}
-
-/* Gruvbox Green */
-.hljs-addition,
-.hljs-meta-string,
-.hljs-section,
-.hljs-selector-attr,
-.hljs-selector-class,
-.hljs-string,
-.hljs-symbol {
-  color: #79740e;
-}
-
-/* Gruvbox Aqua */
-.hljs-attribute,
-.hljs-bullet,
-.hljs-class,
-.hljs-function,
-.hljs-function .hljs-keyword,
-.hljs-meta-keyword,
-.hljs-selector-pseudo,
-.hljs-tag {
-  color: #427b58;
-}
-
-/* Gruvbox Gray */
-.hljs-comment {
-  color: #928374;
-}
-
-/* Gruvbox Purple */
-.hljs-link_label,
-.hljs-literal,
-.hljs-number {
-  color: #8f3f71;
-}
-
-.hljs-comment,
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-section,
-.hljs-strong,
-.hljs-tag {
-  font-weight: bold;
-}

+ 0 - 83
src/utils/highlightjs/styles/monokai-sublime.css

@@ -1,83 +0,0 @@
-/*
-
-Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #23241f;
-}
-
-.hljs,
-.hljs-tag,
-.hljs-subst {
-  color: #f8f8f2;
-}
-
-.hljs-strong,
-.hljs-emphasis {
-  color: #a8a8a2;
-}
-
-.hljs-bullet,
-.hljs-quote,
-.hljs-number,
-.hljs-regexp,
-.hljs-literal,
-.hljs-link {
-  color: #ae81ff;
-}
-
-.hljs-code,
-.hljs-title,
-.hljs-section,
-.hljs-selector-class {
-  color: #a6e22e;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-name,
-.hljs-attr {
-  color: #f92672;
-}
-
-.hljs-symbol,
-.hljs-attribute {
-  color: #66d9ef;
-}
-
-.hljs-params,
-.hljs-class .hljs-title {
-  color: #f8f8f2;
-}
-
-.hljs-string,
-.hljs-type,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-selector-id,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-addition,
-.hljs-variable,
-.hljs-template-variable {
-  color: #e6db74;
-}
-
-.hljs-comment,
-.hljs-deletion,
-.hljs-meta {
-  color: #75715e;
-}

+ 0 - 70
src/utils/highlightjs/styles/monokai.css

@@ -1,70 +0,0 @@
-/*
-Monokai style - ported by Luigi Maselli - http://grigio.org
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #272822; color: #ddd;
-}
-
-.hljs-tag,
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-literal,
-.hljs-strong,
-.hljs-name {
-  color: #f92672;
-}
-
-.hljs-code {
-  color: #66d9ef;
-}
-
-.hljs-class .hljs-title {
-  color: white;
-}
-
-.hljs-attribute,
-.hljs-symbol,
-.hljs-regexp,
-.hljs-link {
-  color: #bf79db;
-}
-
-.hljs-string,
-.hljs-bullet,
-.hljs-subst,
-.hljs-title,
-.hljs-section,
-.hljs-emphasis,
-.hljs-type,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-addition,
-.hljs-variable,
-.hljs-template-tag,
-.hljs-template-variable {
-  color: #a6e22e;
-}
-
-.hljs-comment,
-.hljs-quote,
-.hljs-deletion,
-.hljs-meta {
-  color: #75715e;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-literal,
-.hljs-doctag,
-.hljs-title,
-.hljs-section,
-.hljs-type,
-.hljs-selector-id {
-  font-weight: bold;
-}

+ 0 - 83
src/utils/highlightjs/styles/qtcreator_dark.css

@@ -1,83 +0,0 @@
-/*
-
-Qt Creator dark color scheme
-
-*/
-
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #000000;
-}
-
-.hljs,
-.hljs-subst,
-.hljs-tag,
-.hljs-title {
-  color: #aaaaaa;
-}
-
-.hljs-strong,
-.hljs-emphasis {
-  color: #a8a8a2;
-}
-
-.hljs-bullet,
-.hljs-quote,
-.hljs-number,
-.hljs-regexp,
-.hljs-literal {
-  color: #ff55ff;
-}
-
-.hljs-code
-.hljs-selector-class {
-  color: #aaaaff;
-}
-
-.hljs-emphasis,
-.hljs-stronge,
-.hljs-type {
-  font-style: italic;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-function,
-.hljs-section,
-.hljs-symbol,
-.hljs-name {
-  color: #ffff55;
-}
-
-.hljs-attribute {
-  color: #ff5555;
-}
-
-.hljs-variable,
-.hljs-params,
-.hljs-class .hljs-title {
-  color: #8888ff;
-}
-
-.hljs-string,
-.hljs-selector-id,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-type,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-template-tag,
-.hljs-template-variable,
-.hljs-addition,
-.hljs-link {
-  color: #ff55ff;
-}
-
-.hljs-comment,
-.hljs-meta,
-.hljs-deletion {
-  color: #55ffff;
-}

+ 0 - 83
src/utils/highlightjs/styles/qtcreator_light.css

@@ -1,83 +0,0 @@
-/*
-
-Qt Creator light color scheme
-
-*/
-
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #ffffff;
-}
-
-.hljs,
-.hljs-subst,
-.hljs-tag,
-.hljs-title {
-  color: #000000;
-}
-
-.hljs-strong,
-.hljs-emphasis {
-  color: #000000;
-}
-
-.hljs-bullet,
-.hljs-quote,
-.hljs-number,
-.hljs-regexp,
-.hljs-literal {
-  color: #000080;
-}
-
-.hljs-code
-.hljs-selector-class {
-  color: #800080;
-}
-
-.hljs-emphasis,
-.hljs-stronge,
-.hljs-type {
-  font-style: italic;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-function,
-.hljs-section,
-.hljs-symbol,
-.hljs-name {
-  color: #808000;
-}
-
-.hljs-attribute {
-  color: #800000;
-}
-
-.hljs-variable,
-.hljs-params,
-.hljs-class .hljs-title {
-  color: #0055AF;
-}
-
-.hljs-string,
-.hljs-selector-id,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-type,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-template-tag,
-.hljs-template-variable,
-.hljs-addition,
-.hljs-link {
-  color: #008000;
-}
-
-.hljs-comment,
-.hljs-meta,
-.hljs-deletion {
-  color: #008000;
-}

+ 0 - 85
src/utils/highlightjs/styles/rainbow.css

@@ -1,85 +0,0 @@
-/*
-
-Style with support for rainbow parens
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #474949;
-  color: #d1d9e1;
-}
-
-
-.hljs-comment,
-.hljs-quote {
-  color: #969896;
-  font-style: italic;
-}
-
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-literal,
-.hljs-type,
-.hljs-addition {
-  color: #cc99cc;
-}
-
-.hljs-number,
-.hljs-selector-attr,
-.hljs-selector-pseudo {
-  color: #f99157;
-}
-
-.hljs-string,
-.hljs-doctag,
-.hljs-regexp {
-  color: #8abeb7;
-}
-
-.hljs-title,
-.hljs-name,
-.hljs-section,
-.hljs-built_in {
-  color: #b5bd68;
-}
-
-.hljs-variable,
-.hljs-template-variable,
-.hljs-selector-id,
-.hljs-class .hljs-title {
-   color: #ffcc66;
-}
-
-.hljs-section,
-.hljs-name,
-.hljs-strong {
-  font-weight: bold;
-}
-
-.hljs-symbol,
-.hljs-bullet,
-.hljs-subst,
-.hljs-meta,
-.hljs-link {
-  color: #f99157;
-}
-
-.hljs-deletion {
-  color: #dc322f;
-}
-
-.hljs-formula {
-  background: #eee8d5;
-}
-
-.hljs-attr,
-.hljs-attribute {
-  color: #81a2be;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}

+ 0 - 84
src/utils/highlightjs/styles/solarized-dark.css

@@ -1,84 +0,0 @@
-/*
-
-Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <[email protected]>
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #002b36;
-  color: #839496;
-}
-
-.hljs-comment,
-.hljs-quote {
-  color: #586e75;
-}
-
-/* Solarized Green */
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-addition {
-  color: #859900;
-}
-
-/* Solarized Cyan */
-.hljs-number,
-.hljs-string,
-.hljs-meta .hljs-meta-string,
-.hljs-literal,
-.hljs-doctag,
-.hljs-regexp {
-  color: #2aa198;
-}
-
-/* Solarized Blue */
-.hljs-title,
-.hljs-section,
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class {
-  color: #268bd2;
-}
-
-/* Solarized Yellow */
-.hljs-attribute,
-.hljs-attr,
-.hljs-variable,
-.hljs-template-variable,
-.hljs-class .hljs-title,
-.hljs-type {
-  color: #b58900;
-}
-
-/* Solarized Orange */
-.hljs-symbol,
-.hljs-bullet,
-.hljs-subst,
-.hljs-meta,
-.hljs-meta .hljs-keyword,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-link {
-  color: #cb4b16;
-}
-
-/* Solarized Red */
-.hljs-built_in,
-.hljs-deletion {
-  color: #dc322f;
-}
-
-.hljs-formula {
-  background: #073642;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 84
src/utils/highlightjs/styles/solarized-light.css

@@ -1,84 +0,0 @@
-/*
-
-Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <[email protected]>
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #fdf6e3;
-  color: #657b83;
-}
-
-.hljs-comment,
-.hljs-quote {
-  color: #93a1a1;
-}
-
-/* Solarized Green */
-.hljs-keyword,
-.hljs-selector-tag,
-.hljs-addition {
-  color: #859900;
-}
-
-/* Solarized Cyan */
-.hljs-number,
-.hljs-string,
-.hljs-meta .hljs-meta-string,
-.hljs-literal,
-.hljs-doctag,
-.hljs-regexp {
-  color: #2aa198;
-}
-
-/* Solarized Blue */
-.hljs-title,
-.hljs-section,
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class {
-  color: #268bd2;
-}
-
-/* Solarized Yellow */
-.hljs-attribute,
-.hljs-attr,
-.hljs-variable,
-.hljs-template-variable,
-.hljs-class .hljs-title,
-.hljs-type {
-  color: #b58900;
-}
-
-/* Solarized Orange */
-.hljs-symbol,
-.hljs-bullet,
-.hljs-subst,
-.hljs-meta,
-.hljs-meta .hljs-keyword,
-.hljs-selector-attr,
-.hljs-selector-pseudo,
-.hljs-link {
-  color: #cb4b16;
-}
-
-/* Solarized Red */
-.hljs-built_in,
-.hljs-deletion {
-  color: #dc322f;
-}
-
-.hljs-formula {
-  background: #eee8d5;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 75
src/utils/highlightjs/styles/tomorrow-night-blue.css

@@ -1,75 +0,0 @@
-/* Tomorrow Night Blue Theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-
-/* Tomorrow Comment */
-.hljs-comment,
-.hljs-quote {
-  color: #7285b7;
-}
-
-/* Tomorrow Red */
-.hljs-variable,
-.hljs-template-variable,
-.hljs-tag,
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-regexp,
-.hljs-deletion {
-  color: #ff9da4;
-}
-
-/* Tomorrow Orange */
-.hljs-number,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-literal,
-.hljs-type,
-.hljs-params,
-.hljs-meta,
-.hljs-link {
-  color: #ffc58f;
-}
-
-/* Tomorrow Yellow */
-.hljs-attribute {
-  color: #ffeead;
-}
-
-/* Tomorrow Green */
-.hljs-string,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-addition {
-  color: #d1f1a9;
-}
-
-/* Tomorrow Blue */
-.hljs-title,
-.hljs-section {
-  color: #bbdaff;
-}
-
-/* Tomorrow Purple */
-.hljs-keyword,
-.hljs-selector-tag {
-  color: #ebbbff;
-}
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  background: #002451;
-  color: white;
-  padding: 0.5em;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 74
src/utils/highlightjs/styles/tomorrow-night-bright.css

@@ -1,74 +0,0 @@
-/* Tomorrow Night Bright Theme */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-
-/* Tomorrow Comment */
-.hljs-comment,
-.hljs-quote {
-  color: #969896;
-}
-
-/* Tomorrow Red */
-.hljs-variable,
-.hljs-template-variable,
-.hljs-tag,
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-regexp,
-.hljs-deletion {
-  color: #d54e53;
-}
-
-/* Tomorrow Orange */
-.hljs-number,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-literal,
-.hljs-type,
-.hljs-params,
-.hljs-meta,
-.hljs-link {
-  color: #e78c45;
-}
-
-/* Tomorrow Yellow */
-.hljs-attribute {
-  color: #e7c547;
-}
-
-/* Tomorrow Green */
-.hljs-string,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-addition {
-  color: #b9ca4a;
-}
-
-/* Tomorrow Blue */
-.hljs-title,
-.hljs-section {
-  color: #7aa6da;
-}
-
-/* Tomorrow Purple */
-.hljs-keyword,
-.hljs-selector-tag {
-  color: #c397d8;
-}
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  background: black;
-  color: #eaeaea;
-  padding: 0.5em;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 74
src/utils/highlightjs/styles/tomorrow-night-eighties.css

@@ -1,74 +0,0 @@
-/* Tomorrow Night Eighties Theme */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-
-/* Tomorrow Comment */
-.hljs-comment,
-.hljs-quote {
-  color: #999999;
-}
-
-/* Tomorrow Red */
-.hljs-variable,
-.hljs-template-variable,
-.hljs-tag,
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-regexp,
-.hljs-deletion {
-  color: #f2777a;
-}
-
-/* Tomorrow Orange */
-.hljs-number,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-literal,
-.hljs-type,
-.hljs-params,
-.hljs-meta,
-.hljs-link {
-  color: #f99157;
-}
-
-/* Tomorrow Yellow */
-.hljs-attribute {
-  color: #ffcc66;
-}
-
-/* Tomorrow Green */
-.hljs-string,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-addition {
-  color: #99cc99;
-}
-
-/* Tomorrow Blue */
-.hljs-title,
-.hljs-section {
-  color: #6699cc;
-}
-
-/* Tomorrow Purple */
-.hljs-keyword,
-.hljs-selector-tag {
-  color: #cc99cc;
-}
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  background: #2d2d2d;
-  color: #cccccc;
-  padding: 0.5em;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 75
src/utils/highlightjs/styles/tomorrow-night.css

@@ -1,75 +0,0 @@
-/* Tomorrow Night Theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-/* Original theme - https://github.com/chriskempson/tomorrow-theme */
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-
-/* Tomorrow Comment */
-.hljs-comment,
-.hljs-quote {
-  color: #969896;
-}
-
-/* Tomorrow Red */
-.hljs-variable,
-.hljs-template-variable,
-.hljs-tag,
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-regexp,
-.hljs-deletion {
-  color: #cc6666;
-}
-
-/* Tomorrow Orange */
-.hljs-number,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-literal,
-.hljs-type,
-.hljs-params,
-.hljs-meta,
-.hljs-link {
-  color: #de935f;
-}
-
-/* Tomorrow Yellow */
-.hljs-attribute {
-  color: #f0c674;
-}
-
-/* Tomorrow Green */
-.hljs-string,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-addition {
-  color: #b5bd68;
-}
-
-/* Tomorrow Blue */
-.hljs-title,
-.hljs-section {
-  color: #81a2be;
-}
-
-/* Tomorrow Purple */
-.hljs-keyword,
-.hljs-selector-tag {
-  color: #b294bb;
-}
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  background: #1d1f21;
-  color: #c5c8c6;
-  padding: 0.5em;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 0 - 72
src/utils/highlightjs/styles/tomorrow.css

@@ -1,72 +0,0 @@
-/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
-
-/* Tomorrow Comment */
-.hljs-comment,
-.hljs-quote {
-  color: #8e908c;
-}
-
-/* Tomorrow Red */
-.hljs-variable,
-.hljs-template-variable,
-.hljs-tag,
-.hljs-name,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-regexp,
-.hljs-deletion {
-  color: #c82829;
-}
-
-/* Tomorrow Orange */
-.hljs-number,
-.hljs-built_in,
-.hljs-builtin-name,
-.hljs-literal,
-.hljs-type,
-.hljs-params,
-.hljs-meta,
-.hljs-link {
-  color: #f5871f;
-}
-
-/* Tomorrow Yellow */
-.hljs-attribute {
-  color: #eab700;
-}
-
-/* Tomorrow Green */
-.hljs-string,
-.hljs-symbol,
-.hljs-bullet,
-.hljs-addition {
-  color: #718c00;
-}
-
-/* Tomorrow Blue */
-.hljs-title,
-.hljs-section {
-  color: #4271ae;
-}
-
-/* Tomorrow Purple */
-.hljs-keyword,
-.hljs-selector-tag {
-  color: #8959a8;
-}
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  background: white;
-  color: #4d4d4c;
-  padding: 0.5em;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}

+ 144 - 267
src/vconfigmanager.cpp

@@ -11,6 +11,7 @@
 #include <QCoreApplication>
 #include "utils/vutils.h"
 #include "vstyleparser.h"
+#include "vpalette.h"
 
 const QString VConfigManager::orgName = QString("vnote");
 
@@ -40,16 +41,6 @@ const QString VConfigManager::c_templateConfigFolder = QString("templates");
 
 const QString VConfigManager::c_snippetConfigFolder = QString("snippets");
 
-const QString VConfigManager::c_defaultCssFile = QString(":/resources/styles/default.css");
-
-const QString VConfigManager::c_defaultCodeBlockCssFile = QString(":/utils/highlightjs/styles/vnote.css");
-
-const QString VConfigManager::c_defaultMdhlFile = QString(":/resources/styles/default.mdhl");
-
-const QString VConfigManager::c_solarizedDarkMdhlFile = QString(":/resources/styles/solarized-dark.mdhl");
-
-const QString VConfigManager::c_solarizedLightMdhlFile = QString(":/resources/styles/solarized-light.mdhl");
-
 const QString VConfigManager::c_warningTextStyle = QString("color: red; font: bold");
 
 const QString VConfigManager::c_dataTextStyle = QString("font: bold");
@@ -68,21 +59,25 @@ void VConfigManager::initialize()
 {
     initSettings();
 
-    // Override the default css styles on start up.
-    outputDefaultCssStyle();
-    outputDefaultCodeBlockCssStyle();
-    outputDefaultEditorStyle();
-
     initThemes();
 
-    m_defaultEditPalette = QTextEdit().palette();
+    initEditorStyles();
+
+    initCssStyles();
+
+    initCodeBlockCssStyles();
+
+    m_theme = getConfigFromSettings("global", "theme").toString();
 
     m_editorStyle = getConfigFromSettings("global", "editor_style").toString();
 
+    m_cssStyle = getConfigFromSettings("global", "css_style").toString();
+
+    m_codeBlockCssStyle = getConfigFromSettings("global", "code_block_css_style").toString();
+
+    m_defaultEditPalette = QTextEdit().palette();
+
     welcomePagePath = getConfigFromSettings("global", "welcome_page_path").toString();
-    m_templateCss = getConfigFromSettings("global", "template_css").toString();
-    m_templateCodeBlockCss = getConfigFromSettings("global", "template_code_block_css").toString();
-    m_templateCodeBlockCssUrl = getConfigFromSettings("global", "template_code_block_css_url").toString();
 
     markdownExtensions = hoedown_extensions(HOEDOWN_EXT_TABLES | HOEDOWN_EXT_FENCED_CODE |
                                             HOEDOWN_EXT_HIGHLIGHT | HOEDOWN_EXT_AUTOLINK |
@@ -284,9 +279,6 @@ void VConfigManager::initialize()
 
     m_vimExemptionKeys = getConfigFromSettings("global",
                                                "vim_exemption_keys").toString();
-
-    m_theme = getConfigFromSettings("global",
-                                    "theme").toString();
 }
 
 void VConfigManager::initSettings()
@@ -565,7 +557,9 @@ void VConfigManager::updateMarkdownEditStyle()
     static const QString defaultPreviewImageLineFg = "#9575CD";
 
     // Read style file .mdhl
-    QString file(getEditorStyleUrl());
+    QString file(getEditorStyleFile());
+
+    qDebug() << "use editor style file" << file;
 
     QString styleStr = VUtils::readFileFromDisk(file);
     if (styleStr.isEmpty()) {
@@ -793,34 +787,14 @@ const QString &VConfigManager::getSnippetConfigFilePath() const
 
 QString VConfigManager::getThemeFile() const
 {
-    QString file;
     auto it = m_themes.find(m_theme);
     if (it != m_themes.end()) {
-        file = QDir(getThemeConfigFolder()).filePath(it.value());
-    }
-
-    return file;
-}
-
-QVector<QString> VConfigManager::getCssStyles() const
-{
-    QVector<QString> res;
-    QDir dir(getStyleConfigFolder());
-    if (!dir.exists()) {
-        // Output pre-defined css styles to this folder.
-        outputDefaultCssStyle();
-    }
-
-    // Get all the .css files in the folder.
-    dir.setFilter(QDir::Files | QDir::NoSymLinks);
-    dir.setNameFilters(QStringList("*.css"));
-    QStringList files = dir.entryList();
-    res.reserve(files.size());
-    for (auto const &item : files) {
-        res.push_back(item.left(item.size() - 4));
+        return it.value();
+    } else {
+        qWarning() << "use default theme due to missing specified theme" << m_theme;
+        const_cast<VConfigManager *>(this)->m_theme = getDefaultConfig("global", "theme").toString();
+        return m_themes[m_theme];
     }
-
-    return res;
 }
 
 QVector<QString> VConfigManager::getNoteTemplates(DocType p_type) const
@@ -845,249 +819,78 @@ QVector<QString> VConfigManager::getNoteTemplates(DocType p_type) const
     return res;
 }
 
-QVector<QString> VConfigManager::getCodeBlockCssStyles() const
-{
-    QVector<QString> res;
-    QDir dir(getCodeBlockStyleConfigFolder());
-    if (!dir.exists()) {
-        // Output pre-defined CSS styles to this folder.
-        outputDefaultCodeBlockCssStyle();
-    }
-
-    // Get all the .css files in the folder.
-    dir.setFilter(QDir::Files | QDir::NoSymLinks);
-    dir.setNameFilters(QStringList("*.css"));
-    QStringList files = dir.entryList();
-    res.reserve(files.size());
-    for (auto const &item : files) {
-        res.push_back(item.left(item.size() - 4));
-    }
-
-    return res;
-}
-
-QVector<QString> VConfigManager::getEditorStyles() const
-{
-    QVector<QString> res;
-    QDir dir(getStyleConfigFolder());
-    if (!dir.exists()) {
-        // Output pre-defined mdhl styles to this folder.
-        outputDefaultEditorStyle();
-    }
-
-    // Get all the .mdhl files in the folder.
-    dir.setFilter(QDir::Files | QDir::NoSymLinks);
-    dir.setNameFilters(QStringList("*.mdhl"));
-    QStringList files = dir.entryList();
-    res.reserve(files.size());
-    for (auto const &item : files) {
-        res.push_back(item.left(item.size() - 5));
-    }
-
-    return res;
-}
-
-bool VConfigManager::outputDefaultCssStyle() const
+// The URL will be used in the Web page.
+QString VConfigManager::getCssStyleUrl() const
 {
-    // Make sure the styles folder exists.
-    QString folderPath = getStyleConfigFolder();
-    QDir dir(folderPath);
-    if (!dir.exists()) {
-        if (!dir.mkpath(folderPath)) {
-            return false;
-        }
-    }
+    Q_ASSERT(!m_themes.isEmpty());
+    Q_ASSERT(!m_cssStyles.isEmpty());
 
-    QString srcPath = c_defaultCssFile;
-    QString destPath = folderPath + QDir::separator() + QFileInfo(srcPath).fileName();
-
-    if (QFileInfo::exists(destPath)) {
-        QString bakPath = destPath + ".bak";
-        // We only keep one bak file.
-        if (!QFileInfo::exists(bakPath)) {
-            QFile::rename(destPath, bakPath);
-        } else {
-            // Just delete the default style.
-            QFile file(destPath);
-            file.setPermissions(QFile::ReadUser | QFile::WriteUser);
-            file.remove();
-        }
+    if (m_cssStyle.isEmpty()) {
+        // Use theme's style.
+        const_cast<VConfigManager *>(this)->m_cssStyle = VPalette::themeCssStyle(getThemeFile());
     }
 
-    return VUtils::copyFile(srcPath, destPath, false);
-}
-
-bool VConfigManager::outputDefaultCodeBlockCssStyle() const
-{
-    // Make sure the styles folder exists.
-    QString folderPath = getCodeBlockStyleConfigFolder();
-    QDir dir(folderPath);
-    if (!dir.exists()) {
-        if (!dir.mkpath(folderPath)) {
-            return false;
-        }
+    QString cssPath;
+    auto it = m_cssStyles.find(m_cssStyle);
+    if (it != m_cssStyles.end()) {
+        cssPath = it.value();
     }
 
-    QString srcPath = c_defaultCodeBlockCssFile;
-    QString destPath = folderPath + QDir::separator() + QFileInfo(srcPath).fileName();
-
-    if (QFileInfo::exists(destPath)) {
-        QString bakPath = destPath + ".bak";
-        // We only keep one bak file.
-        if (!QFileInfo::exists(bakPath)) {
-            QFile::rename(destPath, bakPath);
-        } else {
-            // Just delete the default style.
-            QFile file(destPath);
-            file.setPermissions(QFile::ReadUser | QFile::WriteUser);
-            file.remove();
-        }
+    if (cssPath.startsWith(":")) {
+        cssPath = "qrc" + cssPath;
+    } else {
+        QUrl cssUrl = QUrl::fromLocalFile(cssPath);
+        cssPath = cssUrl.toString();
     }
 
-    return VUtils::copyFile(srcPath, destPath, false);
+    qDebug() << "use css style file" << cssPath;
+    return cssPath;
 }
 
-bool VConfigManager::outputDefaultEditorStyle() const
+QString VConfigManager::getCodeBlockCssStyleUrl() const
 {
-    // Make sure the styles folder exists.
-    QDir dir(getConfigFolder());
-    if (!dir.exists(c_styleConfigFolder)) {
-        if (!dir.mkdir(c_styleConfigFolder)) {
-            return false;
-        }
-    }
+    Q_ASSERT(!m_themes.isEmpty());
+    Q_ASSERT(!m_codeBlockCssStyles.isEmpty());
 
-    // Always override the deafult style.
-    QString srcPath = c_defaultMdhlFile;
-    QString destPath = getStyleConfigFolder() + QDir::separator() + QFileInfo(srcPath).fileName();
-
-    if (QFileInfo::exists(destPath)) {
-        QString bakPath = destPath + ".bak";
-        // We only keep one bak file.
-        if (!QFileInfo::exists(bakPath)) {
-            QFile::rename(destPath, bakPath);
-        } else {
-            // Just delete the default style.
-            QFile file(destPath);
-            file.setPermissions(QFile::ReadUser | QFile::WriteUser);
-            file.remove();
-        }
-    }
-
-    if (!VUtils::copyFile(srcPath, destPath, false)) {
-        return false;
+    if (m_codeBlockCssStyle.isEmpty()) {
+        // Use theme's style.
+        const_cast<VConfigManager *>(this)->m_codeBlockCssStyle =
+            VPalette::themeCodeBlockCssStyle(getThemeFile());
     }
 
-    srcPath = c_solarizedDarkMdhlFile;
-    destPath = getStyleConfigFolder() + QDir::separator() + QFileInfo(srcPath).fileName();
-    if (!QFileInfo::exists(destPath)) {
-        if (!VUtils::copyFile(srcPath, destPath, false)) {
-            return false;
-        }
+    QString cssPath;
+    auto it = m_codeBlockCssStyles.find(m_codeBlockCssStyle);
+    if (it != m_codeBlockCssStyles.end()) {
+        cssPath = it.value();
     }
 
-    srcPath = c_solarizedLightMdhlFile;
-    destPath = getStyleConfigFolder() + QDir::separator() + QFileInfo(srcPath).fileName();
-    if (!QFileInfo::exists(destPath)) {
-        if (!VUtils::copyFile(srcPath, destPath, false)) {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-// The URL will be used in the Web page.
-QString VConfigManager::getTemplateCssUrl()
-{
-    QString cssPath = getStyleConfigFolder() +
-                      QDir::separator() +
-                      m_templateCss + ".css";
-    QUrl cssUrl = QUrl::fromLocalFile(cssPath);
-    cssPath = cssUrl.toString();
-    if (!QFile::exists(cssUrl.toLocalFile())) {
-        // Specified css not exists.
-        if (m_templateCss == "default") {
-            bool ret = outputDefaultCssStyle();
-            if (!ret) {
-                // Use embedded file.
-                cssPath = "qrc" + c_defaultCssFile;
-            }
-        } else {
-            setTemplateCss("default");
-            return getTemplateCssUrl();
-        }
+    if (cssPath.startsWith(":")) {
+        cssPath = "qrc" + cssPath;
+    } else {
+        QUrl cssUrl = QUrl::fromLocalFile(cssPath);
+        cssPath = cssUrl.toString();
     }
 
-    qDebug() << "use template css:" << cssPath;
+    qDebug() << "use code block css style file" << cssPath;
     return cssPath;
 }
 
-// The URL will be used in the Web page.
-QString VConfigManager::getTemplateCodeBlockCssUrl()
+QString VConfigManager::getEditorStyleFile() const
 {
-    if (!m_templateCodeBlockCssUrl.isEmpty()) {
-        return m_templateCodeBlockCssUrl;
-    }
+    Q_ASSERT(!m_themes.isEmpty());
+    Q_ASSERT(!m_editorStyles.isEmpty());
 
-    QString cssPath = getCodeBlockStyleConfigFolder() +
-                      QDir::separator() +
-                      m_templateCodeBlockCss + ".css";
-    QUrl cssUrl = QUrl::fromLocalFile(cssPath);
-    cssPath = cssUrl.toString();
-    if (!QFile::exists(cssUrl.toLocalFile())) {
-        // Specified css not exists.
-        if (m_templateCss == "vnote") {
-            bool ret = outputDefaultCodeBlockCssStyle();
-            if (!ret) {
-                // Use embedded file.
-                cssPath = "qrc" + c_defaultCodeBlockCssFile;
-            }
-        } else {
-            setTemplateCodeBlockCss("vnote");
-            return getTemplateCodeBlockCssUrl();
-        }
+    if (m_editorStyle.isEmpty()) {
+        // Use theme's style.
+        const_cast<VConfigManager *>(this)->m_editorStyle = VPalette::themeEditorStyle(getThemeFile());
     }
 
-    qDebug() << "use template code block css:" << cssPath;
-    return cssPath;
-}
-
-QString VConfigManager::getEditorStyleUrl()
-{
-    QString mdhlPath = getStyleConfigFolder() + QDir::separator() + m_editorStyle + ".mdhl";
-    if (!QFile::exists(mdhlPath)) {
-        // Specified mdhl file not exists.
-        if (m_editorStyle == "default") {
-            bool ret = outputDefaultEditorStyle();
-            if (!ret) {
-                // Use embedded file.
-                mdhlPath = c_defaultMdhlFile;
-            }
-        } else {
-            setEditorStyle("default");
-            return getEditorStyleUrl();
-        }
+    auto it = m_editorStyles.find(m_editorStyle);
+    if (it != m_editorStyles.end()) {
+        return it.value();
     }
 
-    qDebug() << "use editor style:" << mdhlPath;
-    return mdhlPath;
-
-}
-
-const QString &VConfigManager::getEditorStyle() const
-{
-    return m_editorStyle;
-}
-
-void VConfigManager::setEditorStyle(const QString &p_style)
-{
-    if (m_editorStyle == p_style) {
-        return;
-    }
-    m_editorStyle = p_style;
-    setConfigToSettings("global", "editor_style", m_editorStyle);
-    updateEditStyle();
+    return QString();
 }
 
 QString VConfigManager::getVnoteNotebookFolderPath()
@@ -1363,8 +1166,10 @@ void VConfigManager::initThemes()
     m_themes.clear();
 
     // Built-in.
-    m_themes.insert(tr("v_white"), ":/resources/themes/v_white/v_white.palette");
-    m_themes.insert(tr("v_pure"), ":/resources/themes/v_pure/v_pure.palette");
+    QString file(":/resources/themes/v_white/v_white.palette");
+    m_themes.insert(VPalette::themeName(file), file);
+    file = ":/resources/themes/v_pure/v_pure.palette";
+    m_themes.insert(VPalette::themeName(file), file);
 
     // User theme folder.
     QDir dir(getThemeConfigFolder());
@@ -1383,6 +1188,78 @@ void VConfigManager::initThemes()
         }
 
         QFileInfo fi(files[0]);
-        m_themes.insert(fi.completeBaseName(), themeDir.filePath(files[0]));
+        m_themes.insert(VPalette::themeName(files[0]), themeDir.filePath(files[0]));
+    }
+}
+
+void VConfigManager::initEditorStyles()
+{
+    Q_ASSERT(!m_themes.isEmpty());
+
+    // Styles from themes.
+    m_editorStyles = VPalette::editorStylesFromThemes(m_themes.values());
+
+    // User style folder.
+    // Get all the .mdhl files in the folder.
+    QDir dir(getStyleConfigFolder());
+    if (!dir.exists()) {
+        dir.mkpath(getStyleConfigFolder());
+        return;
+    }
+
+    dir.setFilter(QDir::Files | QDir::NoSymLinks);
+    dir.setNameFilters(QStringList("*.mdhl"));
+    QStringList files = dir.entryList();
+    for (auto const &item : files) {
+        QFileInfo fi(item);
+        m_editorStyles.insert(fi.completeBaseName(), dir.filePath(item));
+    }
+}
+
+void VConfigManager::initCssStyles()
+{
+    Q_ASSERT(!m_themes.isEmpty());
+
+    // Styles from themes.
+    m_cssStyles = VPalette::cssStylesFromThemes(m_themes.values());
+
+    // User style folder.
+    // Get all the .css files in the folder.
+    QDir dir(getStyleConfigFolder());
+    if (!dir.exists()) {
+        dir.mkpath(getStyleConfigFolder());
+        return;
+    }
+
+    dir.setFilter(QDir::Files | QDir::NoSymLinks);
+    dir.setNameFilters(QStringList("*.css"));
+    QStringList files = dir.entryList();
+    for (auto const &item : files) {
+        QFileInfo fi(item);
+        m_cssStyles.insert(fi.completeBaseName(), dir.filePath(item));
+    }
+}
+
+void VConfigManager::initCodeBlockCssStyles()
+{
+    Q_ASSERT(!m_themes.isEmpty());
+
+    // Styles from themes.
+    m_codeBlockCssStyles = VPalette::codeBlockCssStylesFromThemes(m_themes.values());
+
+    // User style folder.
+    // Get all the .css files in the folder.
+    QDir dir(getCodeBlockStyleConfigFolder());
+    if (!dir.exists()) {
+        dir.mkpath(getCodeBlockStyleConfigFolder());
+        return;
+    }
+
+    dir.setFilter(QDir::Files | QDir::NoSymLinks);
+    dir.setNameFilters(QStringList("*.css"));
+    QStringList files = dir.entryList();
+    for (auto const &item : files) {
+        QFileInfo fi(item);
+        m_codeBlockCssStyles.insert(fi.completeBaseName(), dir.filePath(item));
     }
 }

+ 112 - 87
src/vconfigmanager.h

@@ -97,21 +97,20 @@ public:
 
     QString getLogFilePath() const;
 
-    QString getTemplateCssUrl();
+    // Get the css style URL for web view.
+    QString getCssStyleUrl() const;
 
-    QString getTemplateCodeBlockCssUrl();
-
-    QString getEditorStyleUrl();
-
-    const QString &getTemplateCss() const;
-    void setTemplateCss(const QString &p_css);
-
-    const QString &getTemplateCodeBlockCss() const;
-    void setTemplateCodeBlockCss(const QString &p_css);
+    QString getCodeBlockCssStyleUrl() const;
 
     const QString &getEditorStyle() const;
     void setEditorStyle(const QString &p_style);
 
+    const QString &getCssStyle() const;
+    void setCssStyle(const QString &p_style);
+
+    const QString &getCodeBlockCssStyle() const;
+    void setCodeBlockCssStyle(const QString &p_style);
+
     QFont getBaseEditFont() const;
     QPalette getBaseEditPalette() const;
 
@@ -308,9 +307,6 @@ public:
 
     bool getDoubleClickCloseTab() const;
 
-    // Whether user specify template_code_block_css_url directly.
-    bool getUserSpecifyTemplateCodeBlockCssUrl() const;
-
     bool getEnableCompactMode() const;
     void setEnableCompactMode(bool p_enabled);
 
@@ -357,22 +353,20 @@ public:
 
     const QString &getSnippetConfigFilePath() const;
 
-    QString getThemeFile() const;
-
-    // Read all available css files in c_styleConfigFolder.
-    QVector<QString> getCssStyles() const;
-
     // Read all available templates files in c_templateConfigFolder.
     QVector<QString> getNoteTemplates(DocType p_type = DocType::Unknown) const;
 
     // Get the folder c_codeBlockStyleConfigFolder in the config folder.
     const QString &getCodeBlockStyleConfigFolder() const;
 
-    // Read all available css files in c_codeBlockStyleConfigFolder.
-    QVector<QString> getCodeBlockCssStyles() const;
+    // All the editor styles.
+    QList<QString> getEditorStyles() const;
 
-    // Read all available mdhl files in c_styleConfigFolder.
-    QVector<QString> getEditorStyles() const;
+    // All the css styles.
+    QList<QString> getCssStyles() const;
+
+    // All the css styles.
+    QList<QString> getCodeBlockCssStyles() const;
 
     // Return the timer interval for checking file.
     int getFileTimerInterval() const;
@@ -401,6 +395,8 @@ public:
 
     void setTheme(const QString &p_theme);
 
+    QString getThemeFile() const;
+
 private:
     // Look up a config from user and default settings.
     QVariant getConfigFromSettings(const QString &section, const QString &key) const;
@@ -445,13 +441,6 @@ private:
 
     void updateMarkdownEditStyle();
 
-    // Output pre-defined CSS styles to style folder.
-    bool outputDefaultCssStyle() const;
-
-    bool outputDefaultCodeBlockCssStyle() const;
-
-    bool outputDefaultEditorStyle() const;
-
     // See if the old c_obsoleteDirConfigFile exists. If so, rename it to
     // the new one; if not, use the c_dirConfigFile.
     static QString fetchDirConfigFilePath(const QString &p_path);
@@ -481,6 +470,15 @@ private:
     // Init the themes name-file mappings.
     void initThemes();
 
+    // Init the editor styles name-file mappings.
+    void initEditorStyles();
+
+    void initCssStyles();
+
+    void initCodeBlockCssStyles();
+
+    QString getEditorStyleFile() const;
+
     // Default font and palette.
     QFont m_defaultEditFont;
     QPalette m_defaultEditPalette;
@@ -498,18 +496,6 @@ private:
 
     QString welcomePagePath;
 
-    // CSS style for Markdown template.
-    QString m_templateCss;
-
-    // Code block CSS style for Markdown template.
-    QString m_templateCodeBlockCss;
-
-    // Code block CSS style file URL for Markdown template.
-    // If not empty, VNote will ignore m_templateCodeBlockCss.
-    QString m_templateCodeBlockCssUrl;
-
-    QString m_editorStyle;
-
     // Index of current notebook.
     int curNotebookIndex;
 
@@ -762,6 +748,27 @@ private:
     // [name] -> [file path].
     QMap<QString, QString> m_themes;
 
+    // The editor style name.
+    QString m_editorStyle;
+
+    // All the editor styles.
+    // [name] -> [file path].
+    QMap<QString, QString> m_editorStyles;
+
+    // The web view css style name.
+    QString m_cssStyle;
+
+    // All the css styles.
+    // [name] -> [file path].
+    QMap<QString, QString> m_cssStyles;
+
+    // The web view code block css style name.
+    QString m_codeBlockCssStyle;
+
+    // All the css styles.
+    // [name] -> [file path].
+    QMap<QString, QString> m_codeBlockCssStyles;
+
     // The name of the config file in each directory, obsolete.
     // Use c_dirConfigFile instead.
     static const QString c_obsoleteDirConfigFile;
@@ -806,17 +813,6 @@ private:
     // The folder name of snippet files.
     static const QString c_snippetConfigFolder;
 
-    // Default CSS file in resource system.
-    static const QString c_defaultCssFile;
-
-    // Default code block CSS file in resource system.
-    static const QString c_defaultCodeBlockCssFile;
-
-    // MDHL files for editor styles.
-    static const QString c_defaultMdhlFile;
-    static const QString c_solarizedDarkMdhlFile;
-    static const QString c_solarizedLightMdhlFile;
-
     // The folder name to store all notebooks if user does not specify one.
     static const QString c_vnoteNotebookFolderName;
 };
@@ -1761,41 +1757,6 @@ inline bool VConfigManager::getDoubleClickCloseTab() const
     return m_doubleClickCloseTab;
 }
 
-inline const QString &VConfigManager::getTemplateCss() const
-{
-    return m_templateCss;
-}
-
-inline void VConfigManager::setTemplateCss(const QString &p_css)
-{
-    if (m_templateCss == p_css) {
-        return;
-    }
-
-    m_templateCss = p_css;
-    setConfigToSettings("global", "template_css", m_templateCss);
-}
-
-inline const QString &VConfigManager::getTemplateCodeBlockCss() const
-{
-    return m_templateCodeBlockCss;
-}
-
-inline void VConfigManager::setTemplateCodeBlockCss(const QString &p_css)
-{
-    if (m_templateCodeBlockCss == p_css) {
-        return;
-    }
-
-    m_templateCodeBlockCss = p_css;
-    setConfigToSettings("global", "template_code_block_css", m_templateCodeBlockCss);
-}
-
-inline bool VConfigManager::getUserSpecifyTemplateCodeBlockCssUrl() const
-{
-    return !m_templateCodeBlockCssUrl.isEmpty();
-}
-
 inline bool VConfigManager::getEnableCompactMode() const
 {
     return m_enableCompactMode;
@@ -1884,6 +1845,70 @@ inline void VConfigManager::setTheme(const QString &p_theme)
 
     m_theme = p_theme;
     setConfigToSettings("global", "theme", m_theme);
+    setConfigToSettings("global", "editor_style", "");
+    setConfigToSettings("global", "css_style", "");
+    setConfigToSettings("global", "code_block_css_style", "");
+}
+
+inline QList<QString> VConfigManager::getEditorStyles() const
+{
+    return m_editorStyles.keys();
+}
+
+inline const QString &VConfigManager::getEditorStyle() const
+{
+    return m_editorStyle;
+}
+
+inline void VConfigManager::setEditorStyle(const QString &p_style)
+{
+    if (m_editorStyle == p_style) {
+        return;
+    }
+
+    m_editorStyle = p_style;
+    setConfigToSettings("global", "editor_style", m_editorStyle);
+    updateEditStyle();
+}
+
+inline QList<QString> VConfigManager::getCssStyles() const
+{
+    return m_cssStyles.keys();
+}
+
+inline const QString &VConfigManager::getCssStyle() const
+{
+    return m_cssStyle;
+}
+
+inline void VConfigManager::setCssStyle(const QString &p_style)
+{
+    if (m_cssStyle == p_style) {
+        return;
+    }
+
+    m_cssStyle = p_style;
+    setConfigToSettings("global", "css_style", m_cssStyle);
+}
+
+inline QList<QString> VConfigManager::getCodeBlockCssStyles() const
+{
+    return m_codeBlockCssStyles.keys();
+}
+
+inline const QString &VConfigManager::getCodeBlockCssStyle() const
+{
+    return m_codeBlockCssStyle;
+}
+
+inline void VConfigManager::setCodeBlockCssStyle(const QString &p_style)
+{
+    if (m_codeBlockCssStyle == p_style) {
+        return;
+    }
+
+    m_codeBlockCssStyle = p_style;
+    setConfigToSettings("global", "code_block_css_style", m_codeBlockCssStyle);
 }
 
 #endif // VCONFIGMANAGER_H

+ 59 - 166
src/vmainwindow.cpp

@@ -1518,30 +1518,34 @@ void VMainWindow::initRenderBackgroundMenu(QMenu *menu)
     }
 }
 
-void VMainWindow::updateRenderStyleMenu()
+void VMainWindow::initRenderStyleMenu(QMenu *p_menu)
 {
-    QMenu *menu = dynamic_cast<QMenu *>(sender());
-    V_ASSERT(menu);
+    QMenu *styleMenu = p_menu->addMenu(tr("Rendering &Style"));
+    styleMenu->setToolTipsVisible(true);
 
-    QList<QAction *> actions = menu->actions();
-    // Remove all other actions except the first one.
-    for (int i = 1; i < actions.size(); ++i) {
-        menu->removeAction(actions[i]);
-        m_renderStyleActs->removeAction(actions[i]);
-        delete actions[i];
-    }
+    QActionGroup *ag = new QActionGroup(this);
+    connect(ag, &QActionGroup::triggered,
+            this, [this](QAction *p_action) {
+                if (!p_action) {
+                    return;
+                }
 
-    // Update the menu actions with styles.
-    QString curStyle = g_config->getTemplateCss();
-    QVector<QString> styles = g_config->getCssStyles();
+                QString data = p_action->data().toString();
+                g_config->setCssStyle(data);
+                vnote->updateTemplate();
+            });
+
+    QList<QString> styles = g_config->getCssStyles();
+    QString curStyle = g_config->getCssStyle();
     for (auto const &style : styles) {
-        QAction *act = new QAction(style, m_renderStyleActs);
-        act->setToolTip(tr("Set as the CSS style for Markdown rendering"));
+        QAction *act = new QAction(style, ag);
+        act->setToolTip(tr("Set as the CSS style for Markdown rendering "
+                           "(re-open current tabs to make it work)"));
         act->setCheckable(true);
         act->setData(style);
 
         // Add it to the menu.
-        menu->addAction(act);
+        styleMenu->addAction(act);
 
         if (curStyle == style) {
             act->setChecked(true);
@@ -1549,52 +1553,34 @@ void VMainWindow::updateRenderStyleMenu()
     }
 }
 
-void VMainWindow::initRenderStyleMenu(QMenu *p_menu)
+void VMainWindow::initCodeBlockStyleMenu(QMenu *p_menu)
 {
-    QMenu *styleMenu = p_menu->addMenu(tr("Rendering &Style"));
+    QMenu *styleMenu = p_menu->addMenu(tr("Code Block Style"));
     styleMenu->setToolTipsVisible(true);
-    connect(styleMenu, &QMenu::aboutToShow,
-            this, &VMainWindow::updateRenderStyleMenu);
-
-    m_renderStyleActs = new QActionGroup(this);
-    connect(m_renderStyleActs, &QActionGroup::triggered,
-            this, &VMainWindow::setRenderStyle);
 
-    QAction *addAct = newAction(VIconUtils::menuIcon(":/resources/icons/add_style.svg"),
-                                tr("&Add Style"),
-                                m_renderStyleActs);
-    addAct->setToolTip(tr("Open the folder to add your custom CSS style files "
-                          "for Markdown rendering"));
-    addAct->setCheckable(true);
-    addAct->setData("AddStyle");
-
-    styleMenu->addAction(addAct);
-}
-
-void VMainWindow::updateCodeBlockStyleMenu()
-{
-    QMenu *menu = dynamic_cast<QMenu *>(sender());
-    V_ASSERT(menu);
+    QActionGroup *ag = new QActionGroup(this);
+    connect(ag, &QActionGroup::triggered,
+            this, [this](QAction *p_action) {
+                if (!p_action) {
+                    return;
+                }
 
-    QList<QAction *> actions = menu->actions();
-    // Remove all other actions except the first one.
-    for (int i = 1; i < actions.size(); ++i) {
-        menu->removeAction(actions[i]);
-        m_codeBlockStyleActs->removeAction(actions[i]);
-        delete actions[i];
-    }
+                QString data = p_action->data().toString();
+                g_config->setCodeBlockCssStyle(data);
+                vnote->updateTemplate();
+            });
 
-    // Update the menu actions with styles.
-    QString curStyle = g_config->getTemplateCodeBlockCss();
-    QVector<QString> styles = g_config->getCodeBlockCssStyles();
+    QList<QString> styles = g_config->getCodeBlockCssStyles();
+    QString curStyle = g_config->getCodeBlockCssStyle();
     for (auto const &style : styles) {
-        QAction *act = new QAction(style, m_codeBlockStyleActs);
-        act->setToolTip(tr("Set as the code block CSS style for Markdown rendering"));
+        QAction *act = new QAction(style, ag);
+        act->setToolTip(tr("Set as the code block CSS style for Markdown rendering "
+                           "(re-open current tabs to make it work)"));
         act->setCheckable(true);
         act->setData(style);
 
         // Add it to the menu.
-        menu->addAction(act);
+        styleMenu->addAction(act);
 
         if (curStyle == style) {
             act->setChecked(true);
@@ -1602,32 +1588,6 @@ void VMainWindow::updateCodeBlockStyleMenu()
     }
 }
 
-void VMainWindow::initCodeBlockStyleMenu(QMenu *p_menu)
-{
-    QMenu *styleMenu = p_menu->addMenu(tr("Code Block Style"));
-    styleMenu->setToolTipsVisible(true);
-    connect(styleMenu, &QMenu::aboutToShow,
-            this, &VMainWindow::updateCodeBlockStyleMenu);
-
-    m_codeBlockStyleActs = new QActionGroup(this);
-    connect(m_codeBlockStyleActs, &QActionGroup::triggered,
-            this, &VMainWindow::setCodeBlockStyle);
-
-    QAction *addAct = newAction(VIconUtils::menuIcon(":/resources/icons/add_style.svg"),
-                                tr("&Add Style"),
-                                m_codeBlockStyleActs);
-    addAct->setToolTip(tr("Open the folder to add your custom CSS style files "
-                          "for Markdown code block rendering"));
-    addAct->setCheckable(true);
-    addAct->setData("AddStyle");
-
-    styleMenu->addAction(addAct);
-
-    if (g_config->getUserSpecifyTemplateCodeBlockCssUrl()) {
-        styleMenu->setEnabled(false);
-    }
-}
-
 void VMainWindow::initEditorBackgroundMenu(QMenu *menu)
 {
     QMenu *backgroundColorMenu = menu->addMenu(tr("&Background Color"));
@@ -1719,56 +1679,39 @@ void VMainWindow::initEditorLineNumberMenu(QMenu *p_menu)
     }
 }
 
-void VMainWindow::updateEditorStyleMenu()
+void VMainWindow::initEditorStyleMenu(QMenu *p_menu)
 {
-    QMenu *menu = dynamic_cast<QMenu *>(sender());
-    V_ASSERT(menu);
+    QMenu *styleMenu = p_menu->addMenu(tr("Editor &Style"));
+    styleMenu->setToolTipsVisible(true);
 
-    QList<QAction *> actions = menu->actions();
-    // Remove all other actions except the first one.
-    for (int i = 1; i < actions.size(); ++i) {
-        menu->removeAction(actions[i]);
-        m_editorStyleActs->removeAction(actions[i]);
-        delete actions[i];
-    }
+    QActionGroup *ag = new QActionGroup(this);
+    connect(ag, &QActionGroup::triggered,
+            this, [this](QAction *p_action) {
+                if (!p_action) {
+                    return;
+                }
 
-    // Update the menu actions with styles.
-    QVector<QString> styles = g_config->getEditorStyles();
-    for (auto const &style : styles) {
-        QAction *act = new QAction(style, m_editorStyleActs);
-        act->setToolTip(tr("Set as the editor style"));
+                QString data = p_action->data().toString();
+                g_config->setEditorStyle(data);
+            });
+
+    QList<QString> styles = g_config->getEditorStyles();
+    QString style = g_config->getEditorStyle();
+    for (auto const &item : styles) {
+        QAction *act = new QAction(item, ag);
+        act->setToolTip(tr("Set as the editor style (re-open current tabs to make it work)"));
         act->setCheckable(true);
-        act->setData(style);
+        act->setData(item);
 
         // Add it to the menu.
-        menu->addAction(act);
+        styleMenu->addAction(act);
 
-        if (g_config->getEditorStyle() == style) {
+        if (style == item) {
             act->setChecked(true);
         }
     }
 }
 
-void VMainWindow::initEditorStyleMenu(QMenu *p_menu)
-{
-    QMenu *styleMenu = p_menu->addMenu(tr("Editor &Style"));
-    styleMenu->setToolTipsVisible(true);
-    connect(styleMenu, &QMenu::aboutToShow,
-            this, &VMainWindow::updateEditorStyleMenu);
-
-    m_editorStyleActs = new QActionGroup(this);
-    connect(m_editorStyleActs, &QActionGroup::triggered,
-            this, &VMainWindow::setEditorStyle);
-
-    QAction *addAct = newAction(VIconUtils::menuIcon(":/resources/icons/add_style.svg"),
-                                tr("&Add Style"), m_editorStyleActs);
-    addAct->setToolTip(tr("Open the folder to add your custom MDHL style files"));
-    addAct->setCheckable(true);
-    addAct->setData("AddStyle");
-
-    styleMenu->addAction(addAct);
-}
-
 void VMainWindow::setRenderBackgroundColor(QAction *action)
 {
     if (!action) {
@@ -1778,56 +1721,6 @@ void VMainWindow::setRenderBackgroundColor(QAction *action)
     vnote->updateTemplate();
 }
 
-void VMainWindow::setRenderStyle(QAction *p_action)
-{
-    if (!p_action) {
-        return;
-    }
-
-    QString data = p_action->data().toString();
-    if (data == "AddStyle") {
-        // Add custom style.
-        QUrl url = QUrl::fromLocalFile(g_config->getStyleConfigFolder());
-        QDesktopServices::openUrl(url);
-    } else {
-        g_config->setTemplateCss(data);
-        vnote->updateTemplate();
-    }
-}
-
-void VMainWindow::setEditorStyle(QAction *p_action)
-{
-    if (!p_action) {
-        return;
-    }
-
-    QString data = p_action->data().toString();
-    if (data == "AddStyle") {
-        // Add custom style.
-        QUrl url = QUrl::fromLocalFile(g_config->getStyleConfigFolder());
-        QDesktopServices::openUrl(url);
-    } else {
-        g_config->setEditorStyle(data);
-    }
-}
-
-void VMainWindow::setCodeBlockStyle(QAction *p_action)
-{
-    if (!p_action) {
-        return;
-    }
-
-    QString data = p_action->data().toString();
-    if (data == "AddStyle") {
-        // Add custom style.
-        QUrl url = QUrl::fromLocalFile(g_config->getCodeBlockStyleConfigFolder());
-        QDesktopServices::openUrl(url);
-    } else {
-        g_config->setTemplateCodeBlockCss(data);
-        vnote->updateTemplate();
-    }
-}
-
 void VMainWindow::updateActionsStateFromTab(const VEditTab *p_tab)
 {
     const VFile *file = p_tab ? p_tab->getFile() : NULL;

+ 0 - 17
src/vmainwindow.h

@@ -110,21 +110,6 @@ private slots:
     void setEditorBackgroundColor(QAction *action);
     void setRenderBackgroundColor(QAction *action);
 
-    void setRenderStyle(QAction *p_action);
-
-    void setEditorStyle(QAction *p_action);
-
-    // Set code block render style.
-    void setCodeBlockStyle(QAction *p_action);
-
-    // Update the render styles menu according to existing files.
-    void updateRenderStyleMenu();
-
-    void updateEditorStyleMenu();
-
-    // Update the code block styles menu according to existing files.
-    void updateCodeBlockStyleMenu();
-
     void changeHighlightCursorLine(bool p_checked);
     void changeHighlightSelectedWord(bool p_checked);
     void changeHighlightSearchedWord(bool p_checked);
@@ -354,8 +339,6 @@ private:
     // Act group for render styles.
     QActionGroup *m_renderStyleActs;
 
-    QActionGroup *m_editorStyleActs;
-
     // Act group for code block render styles.
     QActionGroup *m_codeBlockStyleActs;
 

+ 2 - 2
src/vnote.cpp

@@ -111,8 +111,8 @@ void VNote::updateTemplate()
     s_markdownTemplate = VUtils::readFileFromDisk(c_markdownTemplatePath);
 
     // Must replace the code block holder first.
-    s_markdownTemplate.replace(codeBlockCssHolder, g_config->getTemplateCodeBlockCssUrl());
-    s_markdownTemplate.replace(cssHolder, g_config->getTemplateCssUrl());
+    s_markdownTemplate.replace(codeBlockCssHolder, g_config->getCodeBlockCssStyleUrl());
+    s_markdownTemplate.replace(cssHolder, g_config->getCssStyleUrl());
 
     s_markdownTemplatePDF = s_markdownTemplate;
 

+ 6 - 31
src/vnote.qrc

@@ -4,33 +4,6 @@
         <file>resources/qwebchannel.js</file>
         <file>utils/marked/marked.min.js</file>
         <file>utils/highlightjs/highlight.pack.js</file>
-        <file>utils/highlightjs/styles/androidstudio.css</file>
-        <file>utils/highlightjs/styles/atom-one-dark.css</file>
-        <file>utils/highlightjs/styles/atom-one-light.css</file>
-        <file>utils/highlightjs/styles/darcula.css</file>
-        <file>utils/highlightjs/styles/dark.css</file>
-        <file>utils/highlightjs/styles/darkula.css</file>
-        <file>utils/highlightjs/styles/default.css</file>
-        <file>utils/highlightjs/styles/github-gist.css</file>
-        <file>utils/highlightjs/styles/github.css</file>
-        <file>utils/highlightjs/styles/googlecode.css</file>
-        <file>utils/highlightjs/styles/gruvbox-dark.css</file>
-        <file>utils/highlightjs/styles/gruvbox-light.css</file>
-        <file>utils/highlightjs/styles/monokai-sublime.css</file>
-        <file>utils/highlightjs/styles/monokai.css</file>
-        <file>utils/highlightjs/styles/qtcreator_dark.css</file>
-        <file>utils/highlightjs/styles/qtcreator_light.css</file>
-        <file>utils/highlightjs/styles/rainbow.css</file>
-        <file>utils/highlightjs/styles/solarized-dark.css</file>
-        <file>utils/highlightjs/styles/solarized-light.css</file>
-        <file>utils/highlightjs/styles/tomorrow-night-blue.css</file>
-        <file>utils/highlightjs/styles/tomorrow-night-bright.css</file>
-        <file>utils/highlightjs/styles/tomorrow-night-eighties.css</file>
-        <file>utils/highlightjs/styles/tomorrow-night.css</file>
-        <file>utils/highlightjs/styles/tomorrow.css</file>
-        <file>resources/styles/default.mdhl</file>
-        <file>resources/styles/solarized-light.mdhl</file>
-        <file>resources/styles/solarized-dark.mdhl</file>
         <file>resources/vnote.ini</file>
         <file>resources/icons/create_note_tb.svg</file>
         <file>resources/icons/save_note.svg</file>
@@ -57,7 +30,6 @@
         <file>resources/icons/create_rootdir_tb.svg</file>
         <file>resources/icons/vnote.svg</file>
         <file>resources/icons/vnote.ico</file>
-        <file>resources/vnote.qss</file>
         <file>resources/icons/note_info_tb.svg</file>
         <file>resources/icons/delete_note_tb.svg</file>
         <file>resources/icons/copy.svg</file>
@@ -94,9 +66,6 @@
         <file>resources/icons/close_red.svg</file>
         <file>resources/docs/shortcuts_en.md</file>
         <file>resources/docs/shortcuts_zh.md</file>
-        <file>resources/styles/default.css</file>
-        <file>resources/icons/add_style.svg</file>
-        <file>utils/highlightjs/styles/vnote.css</file>
         <file>utils/showdown/showdown.min.js</file>
         <file>resources/showdown.js</file>
         <file>utils/showdown/showdown-headinganchor.js</file>
@@ -190,5 +159,11 @@
         <file>resources/themes/v_white/menu_radiobutton.svg</file>
         <file>resources/themes/v_pure/menu_checkbox.svg</file>
         <file>resources/themes/v_pure/menu_radiobutton.svg</file>
+        <file>resources/themes/v_pure/v_pure.mdhl</file>
+        <file>resources/themes/v_white/v_white.mdhl</file>
+        <file>resources/themes/v_white/v_white.css</file>
+        <file>resources/themes/v_pure/v_pure.css</file>
+        <file>resources/themes/v_pure/v_pure_codeblock.css</file>
+        <file>resources/themes/v_white/v_white_codeblock.css</file>
     </qresource>
 </RCC>

+ 98 - 14
src/vpalette.cpp

@@ -18,23 +18,12 @@ void VPalette::init(const QString &p_file)
     m_file = QFileInfo(p_file).absoluteFilePath();
 
     QSettings settings(p_file, QSettings::IniFormat);
-    initMetaData(&settings, "metadata");
+    m_data = getPaletteMetaData(m_file);
     initPaleteFromSettings(&settings, "phony");
     initPaleteFromSettings(&settings, "soft_defined");
     initPaleteFromSettings(&settings, "widgets");
-}
 
-void VPalette::initMetaData(QSettings *p_settings, const QString &p_group)
-{
-    p_settings->beginGroup(p_group);
-    // Qss file.
-    QString val = p_settings->value("qss_file").toString();
-    if (!val.isEmpty()) {
-        m_qssFile = QDir(VUtils::basePathFromPath(m_file)).filePath(val);
-        qDebug() << "theme file" << m_file << "qss file" << m_qssFile;
-    }
-
-    p_settings->endGroup();
+    qDebug() << "theme file" << m_file << m_data.toString();
 }
 
 void VPalette::initPaleteFromSettings(QSettings *p_settings, const QString &p_group)
@@ -124,7 +113,7 @@ void VPalette::fillStyle(QString &p_style) const
 
 QString VPalette::fetchQtStyleSheet() const
 {
-    QString style = VUtils::readFileFromDisk(m_qssFile);
+    QString style = VUtils::readFileFromDisk(m_data.m_qssFile);
     fillStyle(style);
     fillAbsoluteUrl(style);
 
@@ -151,3 +140,98 @@ void VPalette::fillAbsoluteUrl(QString &p_style) const
         p_style.replace(idx + reg.cap(1).size() + literalSize, url.size(), abUrl);
     }
 }
+
+QMap<QString, QString> VPalette::editorStylesFromThemes(const QList<QString> &p_themeFiles)
+{
+    QMap<QString, QString> styles;
+    for (auto const & theme : p_themeFiles) {
+        QString value = getPaletteMetaData(theme).m_mdhlFile;
+        if (!value.isEmpty()) {
+            styles.insert(themeName(theme) + "/" + QFileInfo(value).completeBaseName(), value);
+        }
+    }
+
+    return styles;
+}
+
+QMap<QString, QString> VPalette::cssStylesFromThemes(const QList<QString> &p_themeFiles)
+{
+    QMap<QString, QString> styles;
+    for (auto const & theme : p_themeFiles) {
+        QString value = getPaletteMetaData(theme).m_cssFile;
+        if (!value.isEmpty()) {
+            styles.insert(themeName(theme) + "/" + QFileInfo(value).completeBaseName(), value);
+        }
+    }
+
+    return styles;
+}
+
+QMap<QString, QString> VPalette::codeBlockCssStylesFromThemes(const QList<QString> &p_themeFiles)
+{
+    QMap<QString, QString> styles;
+    for (auto const & theme : p_themeFiles) {
+        QString value = getPaletteMetaData(theme).m_codeBlockCssFile;
+        if (!value.isEmpty()) {
+            styles.insert(themeName(theme) + "/" + QFileInfo(value).completeBaseName(), value);
+        }
+    }
+
+    return styles;
+}
+
+VPaletteMetaData VPalette::getPaletteMetaData(const QString &p_paletteFile)
+{
+    VPaletteMetaData data;
+
+    QSettings settings(p_paletteFile, QSettings::IniFormat);
+    QDir dir(VUtils::basePathFromPath(QFileInfo(p_paletteFile).absoluteFilePath()));
+
+    settings.beginGroup("metadata");
+    QString val = settings.value("qss_file").toString();
+    if (!val.isEmpty()) {
+        data.m_qssFile = dir.filePath(val);
+    }
+
+    val = settings.value("mdhl_file").toString();
+    if (!val.isEmpty()) {
+        data.m_mdhlFile = dir.filePath(val);
+    }
+
+    val = settings.value("css_file").toString();
+    if (!val.isEmpty()) {
+        data.m_cssFile = dir.filePath(val);
+    }
+
+    val = settings.value("codeblock_css_file").toString();
+    if (!val.isEmpty()) {
+        data.m_codeBlockCssFile = dir.filePath(val);
+    }
+
+    settings.endGroup();
+
+    return data;
+}
+
+QString VPalette::themeName(const QString &p_paletteFile)
+{
+    return QFileInfo(p_paletteFile).completeBaseName();
+}
+
+QString VPalette::themeEditorStyle(const QString &p_paletteFile)
+{
+    VPaletteMetaData data = getPaletteMetaData(p_paletteFile);
+    return themeName(p_paletteFile) + "/" + QFileInfo(data.m_mdhlFile).completeBaseName();
+}
+
+QString VPalette::themeCssStyle(const QString &p_paletteFile)
+{
+    VPaletteMetaData data = getPaletteMetaData(p_paletteFile);
+    return themeName(p_paletteFile) + "/" + QFileInfo(data.m_cssFile).completeBaseName();
+}
+
+QString VPalette::themeCodeBlockCssStyle(const QString &p_paletteFile)
+{
+    VPaletteMetaData data = getPaletteMetaData(p_paletteFile);
+    return themeName(p_paletteFile) + "/" + QFileInfo(data.m_codeBlockCssFile).completeBaseName();
+}

+ 43 - 3
src/vpalette.h

@@ -3,9 +3,28 @@
 
 #include <QString>
 #include <QHash>
+#include <QMap>
 
 class QSettings;
 
+struct VPaletteMetaData
+{
+    // These are all file PATH, not name.
+    QString m_qssFile;
+    QString m_mdhlFile;
+    QString m_cssFile;
+    QString m_codeBlockCssFile;
+
+    QString toString() const
+    {
+        return QString("palette metadata qss=%1 mdhl=%2 css=%3 codeBlockCss=%4")
+                      .arg(m_qssFile)
+                      .arg(m_mdhlFile)
+                      .arg(m_cssFile)
+                      .arg(m_codeBlockCssFile);
+    }
+};
+
 
 class VPalette
 {
@@ -17,13 +36,34 @@ public:
     // Read QSS file.
     QString fetchQtStyleSheet() const;
 
+    // Read themes and return the mappings of editor styles.
+    static QMap<QString, QString> editorStylesFromThemes(const QList<QString> &p_themeFiles);
+
+    // Read themes and return the mappings of css styles.
+    static QMap<QString, QString> cssStylesFromThemes(const QList<QString> &p_themeFiles);
+
+    // Read themes and return the mappings of css styles.
+    static QMap<QString, QString> codeBlockCssStylesFromThemes(const QList<QString> &p_themeFiles);
+
+    static VPaletteMetaData getPaletteMetaData(const QString &p_paletteFile);
+
+    // Return the name of the theme.
+    static QString themeName(const QString &p_paletteFile);
+
+    // Return the name of the editor style of the theme.
+    static QString themeEditorStyle(const QString &p_paletteFile);
+
+    // Return the name of the css style of the theme.
+    static QString themeCssStyle(const QString &p_paletteFile);
+
+    // Return the name of the css style of the theme.
+    static QString themeCodeBlockCssStyle(const QString &p_paletteFile);
+
 private:
     void init(const QString &p_file);
 
     void initPaleteFromSettings(QSettings *p_settings, const QString &p_group);
 
-    void initMetaData(QSettings *p_settings, const QString &p_group);
-
     void fillStyle(QString &p_style) const;
 
     void fillAbsoluteUrl(QString &p_style) const;
@@ -33,7 +73,7 @@ private:
 
     QHash<QString, QString> m_palette;
 
-    QString m_qssFile;
+    VPaletteMetaData m_data;
 };
 
 #endif // VPALETTE_H