zenity/internal/zenutil/osascripts/color.gojs
2022-05-09 15:50:25 +01:00

16 lines
No EOL
339 B
Text

var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
ObjC.import('stdio')
ObjC.import('stdlib')
try {
var res = app.chooseColor({defaultColor: {{json .}}})
} catch (e) {
if (e.errorNumber === -128) $.exit(1)
$.dprintf(2, e)
$.exit(-1)
}
{'rgb(' + res.map(x => Math.round(x * 255)) + ')'}