summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-08-04 16:43:02 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-08-04 16:43:29 +0100
commit35eebf5c2c495808e643a5b70a8ef8d665aa0c02 (patch)
tree2849693ef9ce484840c115371a36247d9fe0c2af
parent3f1d40cff83dc3c5a68eed8ed828d767c24da1dc (diff)
downloadefl-35eebf5c2c495808e643a5b70a8ef8d665aa0c02.tar.gz
docs: add default dark theme (via --graph-theme-dark) in docgen
-rw-r--r--src/scripts/elua/apps/gendoc.lua81
1 files changed, 77 insertions, 4 deletions
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index cf63b1b9bc..b3efed1617 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -525,29 +525,37 @@ local default_theme = {
style = "filled",
color = "black",
fill_color = "white",
+ font_color = "black",
primary_color = "black",
- primary_fill_color = "gray"
+ primary_fill_color = "gray",
+ primary_font_color = "black"
},
abstract = {
style = "filled",
color = "black",
fill_color = "white",
+ font_color = "black",
primary_color = "black",
- primary_fill_color = "gray"
+ primary_fill_color = "gray",
+ primary_font_color = "black"
},
mixin = {
style = "filled",
color = "blue",
fill_color = "white",
+ font_color = "black",
primary_color = "blue",
- primary_fill_color = "skyblue"
+ primary_fill_color = "skyblue",
+ primary_font_color = "black"
},
interface = {
style = "filled",
color = "cornflowerblue",
fill_color = "white",
+ font_color = "black",
primary_color = "cornflowerblue",
- primary_fill_color = "azure"
+ primary_fill_color = "azure",
+ primary_font_color = "black"
}
},
node = {
@@ -561,6 +569,56 @@ local default_theme = {
size = "6"
}
+local default_theme_dark = {
+ classes = {
+ regular = {
+ style = "filled",
+ color = "gray15",
+ fill_color = "gray15",
+ font_color = "white",
+ primary_color = "gray15",
+ primary_fill_color = "black",
+ primary_font_color = "white"
+ },
+ abstract = {
+ style = "filled",
+ color = "gray15",
+ fill_color = "gray15",
+ font_color = "white",
+ primary_color = "gray15",
+ primary_fill_color = "black",
+ primary_font_color = "white"
+ },
+ mixin = {
+ style = "filled",
+ color = "deepskyblue",
+ fill_color = "gray15",
+ font_color = "white",
+ primary_color = "deepskyblue",
+ primary_fill_color = "deepskyblue4",
+ primary_font_color = "white"
+ },
+ interface = {
+ style = "filled",
+ color = "cornflowerblue",
+ fill_color = "gray15",
+ font_color = "white",
+ primary_color = "cornflowerblue",
+ primary_fill_color = "dodgerblue4",
+ primary_font_color = "white"
+ }
+ },
+ node = {
+ shape = "box"
+ },
+ edge = {
+ color = "gray35"
+ },
+ bg_color = "transparent",
+ rank_dir = "TB",
+ size = "6"
+}
+
local current_theme = default_theme
local validate_ctheme = function(tb, name)
@@ -577,18 +635,27 @@ local validate_ctheme = function(tb, name)
if type(t.fill_color) ~= "string" then
return false
end
+ if type(t.font_color) ~= "string" then
+ return false
+ end
if not t.primary_color then
t.primary_color = t.color
end
if not t.primary_fill_color then
t.primary_fill_color = t.fill_color
end
+ if not t.primary_font_color then
+ t.primary_font_color = t.font_color
+ end
if type(t.primary_color) ~= "string" then
return false
end
if type(t.primary_fill_color) ~= "string" then
return false
end
+ if type(t.primary_font_color) ~= "string" then
+ return false
+ end
return true
end
@@ -681,6 +748,8 @@ local class_to_node = function(cl, main)
ret.color = current_theme.classes[clr][main and "primary_color" or "color"]
ret.fillcolor = current_theme.classes[clr][main and "primary_fill_color"
or "fill_color"]
+ ret.fontcolor = current_theme.classes[clr][main and "primary_font_color"
+ or "font_color"]
-- FIXME: need a dokuwiki graphviz plugin with proper URL support
-- the existing one only supports raw URLs (no dokuwikí namespaces)
@@ -1104,6 +1173,7 @@ getopt.parse {
{ "r", "root", true, help = "Root path of the docs." },
{ "n", "namespace", true, help = "Root namespace of the docs." },
{ nil, "graph-theme", true, help = "Optional graph theme." },
+ { nil, "graph-theme-dark", false, help = "Use dark builtin graph theme." },
{ nil, "disable-graphviz", false, help = "Disable graphviz usage." },
{ nil, "disable-notes", false, help = "Disable notes plugin usage." },
{ nil, "disable-folded", false, help = "Disable folded plugin usage." }
@@ -1116,6 +1186,9 @@ getopt.parse {
if opts["h"] then
return
end
+ if opts["graph-theme-dark"] then
+ current_theme = default_theme_dark
+ end
if opts["graph-theme"] then
set_theme(opts["graph-theme"])
end