fix(image): mermaid theme. Closes #1282

This commit is contained in:
Folke Lemaitre 2025-02-18 21:53:57 +01:00
parent f4583da710
commit 8117fb4cbb
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 9 additions and 2 deletions

View file

@ -93,11 +93,13 @@ local commands = {
end,
},
mmd = {
ft = "png",
cmd = {
cmd = "mmdc",
args = { "-i", "{src}", "-o", "{file}", "-b", "transparent", "-t", "{bg}", "-s", "{scale}" },
args = Snacks.image.config.convert.mermaid,
},
file = function(convert, ctx)
return convert:tmpfile(vim.o.background .. ".png")
end,
},
identify = {
pipe = false,

View file

@ -102,6 +102,11 @@ local defaults = {
env = {},
---@class snacks.image.convert.Config
convert = {
---@type snacks.image.args
mermaid = function()
local theme = vim.o.background == "light" and "neutral" or "dark"
return { "-i", "{src}", "-o", "{file}", "-b", "transparent", "-t", theme, "-s", "{scale}" }
end,
---@type table<string,snacks.image.args>
magick = {
default = { "{src}[0]", "-scale", "1920x1080>" },