summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-07-28 14:09:35 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-07-28 14:09:35 +0100
commit26ebd20db84bcb4197f50397aedae4da3ab2d36a (patch)
tree42a74051ff2026b5bfe7383355e319ef4cf62f34
parentfeccbc7d833e93109fc5eb3862408600fec6ec87 (diff)
docs: initial bits for theming support for graphs
-rw-r--r--src/scripts/elua/apps/gendoc.lua65
1 files changed, 50 insertions, 15 deletions
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index e696f29..6d45598 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -517,16 +517,49 @@ build_inherits = function(cl, t, lvl)
517 return t 517 return t
518end 518end
519 519
520local default_theme = {
521 classes = {
522 regular = {
523 style = "filled",
524 color = "black",
525 fill_color = "white",
526 primary_color = "black",
527 primary_fill_color = "gray"
528 },
529 abstract = {
530 style = "filled",
531 color = "black",
532 fill_color = "white",
533 primary_color = "black",
534 primary_fill_color = "gray"
535 },
536 mixin = {
537 style = "filled",
538 color = "blue",
539 fill_color = "white",
540 primary_color = "blue",
541 primary_fill_color = "skyblue"
542 },
543 interface = {
544 style = "filled",
545 color = "cornflowerblue",
546 fill_color = "white",
547 primary_color = "cornflowerblue",
548 primary_fill_color = "azure"
549 }
550 },
551 node = {
552 shape = "box"
553 },
554 bg_color = "transparent"
555}
520 556
521local class_to_color = function(cl) 557local classt_to_theme = {
522 local classt_to_color = { 558 [eolian.class_type.REGULAR] = "regular",
523 [eolian.class_type.REGULAR] = { "black", "gray" }, 559 [eolian.class_type.ABSTRACT] = "abstract",
524 [eolian.class_type.ABSTRACT] = { "black", "gray" }, 560 [eolian.class_type.MIXIN] = "mixin",
525 [eolian.class_type.MIXIN] = { "blue", "skyblue" }, 561 [eolian.class_type.INTERFACE] = "interface"
526 [eolian.class_type.INTERFACE] = { "cornflowerblue", "azure" } 562}
527 }
528 return classt_to_color[cl:type_get()]
529end
530 563
531local class_to_node = function(cl, main) 564local class_to_node = function(cl, main)
532 local ret = {} 565 local ret = {}
@@ -534,10 +567,12 @@ local class_to_node = function(cl, main)
534 ret.label = cl:full_name_get() 567 ret.label = cl:full_name_get()
535 ret.name = ret.label:lower():gsub("%.", "_") 568 ret.name = ret.label:lower():gsub("%.", "_")
536 569
537 local clr = class_to_color(cl) 570 local clr = classt_to_theme[cl:type_get()]
538 ret.style = "filled" 571
539 ret.color = clr[1] 572 ret.style = default_theme.classes[clr].style
540 ret.fillcolor = main and clr[2] or "white" 573 ret.color = default_theme.classes[clr][main and "primary_color" or "color"]
574 ret.fillcolor = default_theme.classes[clr][main and "primary_fill_color"
575 or "fill_color"]
541 576
542 -- FIXME: need a dokuwiki graphviz plugin with proper URL support 577 -- FIXME: need a dokuwiki graphviz plugin with proper URL support
543 -- the existing one only supports raw URLs (no dokuwikí namespaces) 578 -- the existing one only supports raw URLs (no dokuwikí namespaces)
@@ -567,9 +602,9 @@ local build_igraph = function(cl)
567 attrs = { 602 attrs = {
568 rankdir = "TB", 603 rankdir = "TB",
569 size = "6", 604 size = "6",
570 bgcolor = "transparent" 605 bgcolor = default_theme.bg_color
571 }, 606 },
572 node = { shape = "box" } 607 node = default_theme.node
573 } 608 }
574 609
575 local nbuf = {} 610 local nbuf = {}