summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/luabindings.cc2
-rw-r--r--scripts/s_group_color.lua11
2 files changed, 13 insertions, 0 deletions
diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc
index c95c0a5f2f..591e2bc61c 100644
--- a/libs/ardour/luabindings.cc
+++ b/libs/ardour/luabindings.cc
@@ -926,6 +926,8 @@ LuaBindings::common (lua_State* L)
.addFunction ("add", &RouteGroup::add)
.addFunction ("remove", &RouteGroup::remove)
.addFunction ("clear", &RouteGroup::clear)
+ .addFunction ("set_rgba", &RouteGroup::set_rgba)
+ .addFunction ("rgba", &RouteGroup::rgba)
.addFunction ("has_subgroup", &RouteGroup::has_subgroup)
.addFunction ("make_subgroup", &RouteGroup::make_subgroup)
.addFunction ("destroy_subgroup", &RouteGroup::destroy_subgroup)
diff --git a/scripts/s_group_color.lua b/scripts/s_group_color.lua
new file mode 100644
index 0000000000..1fd5321ef5
--- /dev/null
+++ b/scripts/s_group_color.lua
@@ -0,0 +1,11 @@
+ardour { ["type"] = "Snippet", name = "Randomize Group Colors" }
+
+function factory () return function ()
+ for grb in Session:route_groups ():iter () do
+ local r = math.random (0, 255)
+ local g = math.random (0, 255)
+ local b = math.random (0, 255)
+ local rgba = bit32.lshift (r, 24) + bit32.lshift (g, 16) + bit32.lshift (b, 8) + 0xff
+ grp:set_rgba(rgba)
+ end
+end end