summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/colo-run.lua
blob: 2e4cca5ab7c011da268b38a55ffb101ba3e8b830 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
if not modules then modules = { } end modules ['colo-run'] = {
    version   = 1.000,
    comment   = "companion to colo-run.mkiv",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

-- For historic reasons the core has a couple of tracing features. Nowadays
-- these would end up in modules.

local utilities = utilities
local commands  = commands
local context   = context
local colors    = attributes.colors

local private   = table.tohash { "d_u_m_m_y", "maintextcolor", "themaintextcolor" }

function commands.showcolorset(name)
    local set = colors.setlist(name)
    context.starttabulate { "|l|l|l|l|l|l|l|" }
    for i=1,#set do
        local s = set[i]
        if not private[s] then
            local r = { width = "4em", height = "max", depth = "max", color = s }
            context.NC()
            context.setcolormodel { "gray" }
            context.blackrule(r)
            context.NC()
            context.blackrule(r)
            context.NC()
            context.grayvalue(s)
            context.NC()
            context.colorvalue(s)
            context.NC()
            context(s)
            context.NC()
            context.NR()
        end
    end
    context.stoptabulate()
end

function commands.showcolorcomponents(list)
    local set = utilities.parsers.settings_to_array(list)
    context.starttabulate { "|lT|lT|lT|lT|" }
        context.NC()
        context("color")
        context.NC()
        context("name")
        context.NC()
        context("transparency")
        context.NC()
        context("specification ")
        context.NC()
        context.NR()
        context.TB()
        for i=1,#set do
            local s = set[i]
            if not private[s] then
                context.NC()
                context.showcolorbar { s }
                context.NC()
                context(s)
                context.NC()
                context.transparencycomponents(s)
                context.NC()
                context.colorcomponents(s)
                context.NC()
                context.NR()
            end
        end
    context.stoptabulate()
end