this can be nice ![]()
i need to wrote something:
this program is awesome thank you for developing this bagful program
I have made a script that can do this:
-- Find Layer Script by MrSmithr - 09/10/2025
-- If I helped in any way, please consider a donation to support me and my work:
-- https://ko-fi.com/mrsmithr
-- DISCLAIMER: Provided as-is with no warranty. Use at your own risk. You're responsible for backups and results. Not affiliated with Aseprite.
local dlg
local function trim(s) return (s and s:match("^%s*(.-)%s*$")) or "" end
local function childrenOf(layer)
local ok, kids = pcall(function() return layer.layers end)
if ok and kids then return kids end
return nil
end
local function parentOf(layer)
local ok, p = pcall(function() return layer.parent end)
if ok then return p end
return nil
end
local function findLayerByName(layers, targetLower)
for i = 1, #layers do
local L = layers[i]
if string.lower(L.name):find(targetLower, 1, true) then
return L
end
local kids = childrenOf(L)
if kids then
local found = findLayerByName(kids, targetLower)
if found then return found end
end
end
end
local function colToTbl(c)
if not c then return nil end
local okR, r = pcall(function() return c.red end)
local okG, g = pcall(function() return c.green end)
local okB, b = pcall(function() return c.blue end)
local okA, a = pcall(function() return c.alpha end)
if okR and okG and okB and okA then
return { red=r, green=g, blue=b, alpha=a }
end
return nil
end
local function makeColour(t)
return Color{ red=t.red, green=t.green, blue=t.blue, alpha=t.alpha or 255 }
end
local function lerp(a,b,t) return a + (b-a)*t end
local function lerpCol(a,b,t)
return {
red = math.floor(lerp(a.red, b.red, t)+0.5),
green = math.floor(lerp(a.green, b.green, t)+0.5),
blue = math.floor(lerp(a.blue, b.blue, t)+0.5),
alpha = math.floor(lerp(a.alpha, b.alpha, t)+0.5),
}
end
local pulseTimer = nil
local pulseState = nil
local isPulsing = false
local function stopPulse(restore)
if pulseTimer then pcall(function() pulseTimer:stop() end) end
if restore and pulseState and pulseState.layer then
if pulseState.hadCustom then
pcall(function() pulseState.layer.color = makeColour(pulseState.orig) end)
else
pcall(function() pulseState.layer.color = Color{ alpha=0 } end)
end
app.refresh()
end
isPulsing = false
if dlg then
pcall(function() dlg:modify{ id="findBtn", enabled=true } end)
pcall(function() dlg:modify{ id="layerName", focus=true } end)
end
pulseTimer, pulseState = nil, nil
end
local function startPulse(layer)
local ok, cur = pcall(function() return layer.color end)
if not ok then return end
local orig = colToTbl(cur) or { red=0, green=0, blue=0, alpha=0 }
local hadCustom = (orig.alpha ~= 0)
local state = {
layer = layer,
orig = orig,
hadCustom= hadCustom,
target = hadCustom and orig or { red=64, green=160, blue=255, alpha=255 },
white = { red=255, green=255, blue=255, alpha=255 },
t = 0,
phase = 1,
duration = 24,
}
stopPulse(true)
pulseState = state
isPulsing = true
if dlg then pcall(function() dlg:modify{ id="findBtn", enabled=false } end) end
pulseTimer = Timer{
interval = 1.0/60.0,
ontick = function()
if not pulseState or not pulseState.layer then stopPulse(false); return end
pulseState.t = pulseState.t + 1
local u = math.min(pulseState.t / pulseState.duration, 1)
local from, to
if pulseState.phase == 1 then
from, to = pulseState.white, pulseState.target
else
from, to = pulseState.target, pulseState.orig
end
local c = lerpCol(from, to, u)
pcall(function() pulseState.layer.color = makeColour(c) end)
app.refresh()
if u >= 1 then
if pulseState.phase == 1 then
pulseState.phase = 2
pulseState.t = 0
else
stopPulse(true)
end
end
end
}
pulseTimer:start()
end
dlg = Dialog{ title="Find Layer" }
local function doFind()
local spr = app.activeSprite
if isPulsing then return end
if not spr then app.alert("No sprite is open."); return end
local name = trim(dlg.data.layerName or "")
if name == "" then app.alert("Please enter a layer name."); return end
local layer = findLayerByName(spr.layers, string.lower(name))
if not layer then
app.alert("Layer '"..name.."' not found.")
dlg:modify{ id="layerName", focus=true }
return
end
app.activeLayer = layer
local p = parentOf(layer)
while p do
pcall(function() p.isCollapsed = false end)
p = parentOf(p)
end
app.refresh()
startPulse(layer)
end
dlg:entry{ id="layerName", label="Layer Name:", text="", focus=true }
dlg:button{ id="findBtn", text="Find", focus=true, onclick=doFind }
dlg:show{ wait=false }
Save it as a new Lua file within the scripts folder by navigating to the File menu > Scripts > Open Scripts Folder.