github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vtheme/Mockup.html (about) 1 <!-- Content managed by Project Forge, see [projectforge.md] for details. --> 2 {% import ( 3 "fmt" 4 5 "github.com/kyleu/dbaudit/app/controller/cutil" 6 "github.com/kyleu/dbaudit/app/lib/theme" 7 "github.com/kyleu/dbaudit/app/util" 8 "github.com/kyleu/dbaudit/views/components" 9 ) %} 10 11 {% func MockupTheme(t *theme.Theme, pointer bool, icon string, indent int, ps *cutil.PageState) %}{% stripspace %} 12 <div class="title small-text">{%s t.Key %}</div> 13 {%= MockupColors(util.AppName, "light", t.Light, pointer, icon, indent, ps) %} 14 {%= MockupColors(util.AppName, "dark", t.Dark, pointer, icon, indent, ps) %} 15 {% endstripspace %}{% endfunc %} 16 17 {% func MockupColors(navTitle string, mode string, c *theme.Colors, pointer bool, icon string, indent int, ps *cutil.PageState) %}{% stripspace %} 18 {% code 19 navStyle := fmt.Sprintf("color: %s; background-color: %s;", c.NavForeground, c.NavBackground) 20 21 menuStyle := fmt.Sprintf("color: %s; background-color: %s;", c.MenuForeground, c.MenuBackground) 22 menuLinkStyle := fmt.Sprintf("color: %s;", c.MenuForeground) 23 menuLinkSelectedStyle := fmt.Sprintf("color: %s; background-color: %s;", c.MenuSelectedForeground, c.MenuSelectedBackground) 24 25 mainStyle := fmt.Sprintf("color: %s; background-color: %s;", c.Foreground, c.Background) 26 mutedStyle := fmt.Sprintf("color: %s; background-color: %s;", c.ForegroundMuted, c.BackgroundMuted) 27 linkStyle := fmt.Sprintf("color: %s;", c.LinkForeground) 28 linkVisitedStyle := fmt.Sprintf("color: %s;", c.LinkVisitedForeground) 29 30 cls := "mockup" 31 if mode != "" { 32 cls += " only-" + mode + "-theme" 33 } 34 if pointer { 35 cls += " pointer" 36 } 37 %} 38 {%= components.Indent(true, indent) %} 39 <div class="{%s cls %}"> 40 <div class="mock-nav" style="{%s navStyle %}">{%= components.SVGRef(icon, 12, 12, `icon`, ps) %}{%s navTitle %}</div> 41 <div class="mock-menu" style="{%s menuStyle %}"> 42 <div class="mock-link" style="{%s menuLinkStyle %}">A</div> 43 <div class="mock-link-selected" style="{%s menuLinkSelectedStyle %}">B</div> 44 <div class="mock-link" style="{%s menuLinkStyle %}">C</div> 45 <div class="mock-link" style="{%s menuLinkStyle %}">D</div> 46 </div> 47 <div class="mock-main" style="{%s mainStyle %}"> 48 <div class="mock-muted" style="{%s mutedStyle %}">Welcome!</div> 49 <div> 50 <div class="mock-list">Here's some links:</div> 51 <ul> 52 <li class="mock-link" style="{%s linkStyle %}">New</li> 53 <li class="mock-link" style="{%s linkStyle %}">Also New</li> 54 <li class="mock-link-visited" style="{%s linkVisitedStyle %}">Visited</li> 55 </ul> 56 </div> 57 </div> 58 </div> 59 {% endstripspace %}{% endfunc %}