1if not modules then modules = { } end modules ['mtx-colors'] = {
2 version = 1.001,
3 comment = "companion to mtxrun.lua",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9
10
11local helpinfo = [[
12<?xml version="1.0"?>
13<application>
14 <metadata>
15 <entry name="name">mtx-colors</entry>
16 <entry name="detail">ConTeXt Color Management</entry>
17 <entry name="version">0.10</entry>
18 </metadata>
19 <flags>
20 <category name="basic">
21 <subcategory>
22 <flag name="table"><short>show icc table</short></flag>
23 </subcategory>
24 </category>
25 </flags>
26 <examples>
27 <category>
28 <title>Example</title>
29 <subcategory>
30 <example><command>mtxrun --script color --table somename</command></example>
31 </subcategory>
32 </category>
33 </examples>
34</application>
35]]
36
37local application = logs.application {
38 name = "mtx-colors",
39 banner = "ConTeXt Color Management 0.10",
40 helpinfo = helpinfo,
41}
42
43local report = application.report
44
45if not fontloader then fontloader = fontforge end
46
47dofile(resolvers.findfile("colo-icc.lua","tex"))
48
49scripts = scripts or { }
50scripts.colors = scripts.colors or { }
51
52function scripts.colors.table()
53 local files = environment.files
54 if #files > 0 then
55 for i=1,#files do
56 local profile, okay, message = colors.iccprofile(files[i])
57 if not okay then
58 report(message)
59 else
60 report(table.serialize(profile,"profile"))
61 end
62 end
63 else
64 local files = resolvers.findfiles("*.icc")
65 if #files > 0 then
66 for i=1,#files do
67 report(files[i])
68 end
69 else
70 report("no file(s) given" )
71 end
72 end
73end
74
75
76
77
78if environment.argument("table") then
79 scripts.colors.table()
80elseif environment.argument("exporthelp") then
81 application.export(environment.argument("exporthelp"),environment.files[1])
82else
83 application.help()
84end
85 |