Created
October 18, 2017 12:40
-
-
Save dbcesar/21ee10412e9310652aaa855020b1737d to your computer and use it in GitHub Desktop.
Lua script for set color label on group images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Set color labels to group | |
Script to provide shortcuts for setting color labels in images groups. | |
Useful for those who are RAW+JPEG shooters. | |
Installation and usage: | |
1. Copy this file into ~/.config/darktable/lua/ | |
2. Add `require "colorlabel_group"` to new line in ~/.config/darktable/luarc | |
3. Restart darktable | |
4. Assign a keyboard shortcut to each action via daktable preferences > shortcuts > lua | |
I use the following shortcuts: | |
Set group red - CRTL+F1 | |
Set group yellow - CRTL+F2 | |
Set group green - CRTL+F3 | |
Set group blue - CRTL+F4 | |
Set group purple - CRTL+F5 | |
Author: Diego Cesar (diego.b.cesar@gmail.com), | |
License: GPLv2 | |
This script is based on based on Dom H (dom@hxy.io) work for rating group images | |
]] | |
local dt = require "darktable" | |
local function apply_label(color) | |
local images = dt.gui.action_images | |
for _, i in ipairs(images) do | |
local members = i:get_group_members() | |
for _, m in ipairs(members) do | |
if color == "blue" then | |
m.blue = true | |
elseif color == "red" then | |
m.red = true | |
elseif color == "yellow" then | |
m.yellow = true | |
elseif color == "green" then | |
m.green = true | |
elseif color == "purple" then | |
m.purple = true | |
end | |
end | |
end | |
dt.print("applying color " ..color.. " to group(s)") | |
end | |
dt.register_event("shortcut",function(event, shortcut) | |
apply_label("red") | |
end, "Set group red") | |
dt.register_event("shortcut",function(event, shortcut) | |
apply_label("yellow") | |
end, "Set group yellow") | |
dt.register_event("shortcut",function(event, shortcut) | |
apply_label("green") | |
end, "Set group green") | |
dt.register_event("shortcut",function(event, shortcut) | |
apply_label("blue") | |
end, "Set group blue") | |
dt.register_event("shortcut",function(event, shortcut) | |
apply_label("purple") | |
end, "Set group purple") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment