Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(config): change the floating window style logic #156

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ ba = "ba"
aadd = "aadd"

[files]
extend-exclude = ["CHANGELOG.md"]
extend-exclude = ["CHANGELOG.md", "doc/*"]
34 changes: 17 additions & 17 deletions lua/astrotheme/groups/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
local function callback(c, opts)
local color = require "astrotheme.lib.color"
local base = color.new(c.ui.base)

local float_bg = (opts.border and opts.float and opts.inactive and c.ui.float)
or (opts.border and opts.float and opts.transparent and c.ui.base)
or (opts.border and opts.float and c.ui.float)
or (opts.border and opts.inactive and c.ui.base)
or (opts.border and opts.transparent and c.none)
or (opts.float and c.ui.float)
or (opts.inactive and c.ui.base)
or (opts.border and c.ui.base)
or c.ui.base

return {
--------------------
--- Normal
Expand All @@ -20,32 +31,21 @@ local function callback(c, opts)
--------------------
FloatTitle = {
fg = (opts.title_invert and c.ui.tool) or c.ui.title,
bg = (opts.title_invert and c.ui.title)
or (opts.inactive and c.ui.float)
or (opts.transparent and opts.float and c.ui.base)
or (opts.float and c.ui.float)
or (opts.transparent and c.none)
or c.ui.base,
bg = (opts.title_invert and c.ui.title) or float_bg,
bold = true,
},
FloatBorder = {
fg = (opts.border and opts.float and c.ui.border)
or (opts.transparent and opts.float and c.ui.base)
or (opts.border and opts.inactive and c.ui.border)
or (opts.float and c.ui.float)
or (opts.transparent and c.ui.base)
or (opts.border and c.ui.border)
or c.ui.base,
bg = (opts.inactive and c.ui.float)
or (opts.transparent and opts.float and c.ui.base)
or (opts.float and c.ui.float)
or (opts.transparent and c.none)
or c.ui.base,
bg = float_bg,
},
NormalFloat = {
fg = c.ui.text,
bg = (opts.inactive and c.ui.float)
or (opts.transparent and opts.float and c.ui.base)
or (opts.float and c.ui.float)
or (opts.transparent and c.none)
or c.ui.base,
bg = float_bg,
},

--------------------
Expand Down
68 changes: 22 additions & 46 deletions lua/astrotheme/groups/plugins/telescope.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
---@type AstroThemeCallback
local function callback(c, opts)
local title = {
fg = (opts.title_invert and c.ui.float) or c.ui.title,
bg = (opts.title_invert and c.ui.title)
or (opts.inactive and c.ui.base)
or (opts.transparent and opts.float and c.ui.base)
or (opts.float and c.ui.float)
or (opts.transparent and c.none)
or c.ui.base,
bold = true,
}

local normal = {
fg = c.ui.text,
bg = (opts.inactive and c.ui.base)
or (opts.transparent and opts.float and c.ui.base)
or (opts.float and c.ui.float)
or (opts.transparent and c.none)
or c.ui.base,
}

local border = {
fg = (opts.border and c.ui.border) or (opts.inactive and c.ui.base) or (opts.float and c.ui.float) or c.ui.base,
bg = (opts.border and opts.inactive and c.ui.base)
or (opts.transparent and opts.float and c.ui.base)
or (opts.float and c.ui.float)
or (opts.transparent and c.none)
or c.ui.base,
}
local prompt_bg = (opts.border and opts.float and opts.inactive and c.ui.float)
or (opts.border and opts.float and opts.transparent and c.ui.base)
or (opts.border and opts.float and c.ui.float)
or (opts.border and opts.inactive and c.ui.base)
or (opts.border and opts.transparent and c.none)
or (opts.border and c.ui.base)
or c.ui.prompt

return {
----------------
Expand All @@ -36,14 +15,11 @@ local function callback(c, opts)

TelescopePromptTitle = {
fg = (opts.title_invert and c.ui.float) or c.ui.title,
bg = (opts.title_invert and c.ui.title)
or (opts.float and c.ui.prompt)
or (opts.transparent and c.none)
or c.ui.base,
bg = (opts.title_invert and c.ui.title) or prompt_bg,
bold = true,
},
TelescopeResultsTitle = title,
TelescopePreviewTitle = title,
TelescopeResultsTitle = { link = "FloatTitle" },
TelescopePreviewTitle = { link = "FloatTitle" },

-- TelescopeTitle = "FloatTitle",
-- TelescopePromptTitle = "TelescopeTitle",
Expand All @@ -56,15 +32,10 @@ local function callback(c, opts)

TelescopePromptNormal = {
fg = c.ui.text,
bg = (opts.border and opts.inactive and c.ui.base)
or (opts.border and opts.float and c.ui.base)
or (opts.inactive and c.ui.prompt)
or (opts.float and c.ui.prompt)
or (opts.transparent and c.none)
or c.ui.base,
bg = prompt_bg,
},
TelescopeResultsNormal = normal,
TelescopePreviewNormal = normal,
TelescopeResultsNormal = { link = "NormalFloat" },
TelescopePreviewNormal = { link = "NormalFloat" },

-- TelescopeNormal = "NormalFloat",
-- TelescopePromptNormal = "TelescopeNormal",
Expand All @@ -76,11 +47,16 @@ local function callback(c, opts)
----------------

TelescopePromptBorder = {
fg = (opts.border and c.ui.border) or (opts.inactive and c.ui.base) or (opts.float and c.ui.prompt) or c.ui.base,
bg = (opts.border and opts.inactive and c.ui.base) or (opts.float and c.ui.prompt) or c.ui.prompt,
fg = (opts.border and opts.float and c.ui.border)
or (opts.border and opts.inactive and c.ui.border)
or (opts.border and opts.transparent and c.ui.base)
or (opts.border and c.ui.border)
or c.ui.prompt,
bg = prompt_bg,
},
TelescopeResultsBorder = border,
TelescopePreviewBorder = border,
-- TelescopePromptBorder = border,
TelescopeResultsBorder = { link = "FloatBorder" },
TelescopePreviewBorder = { link = "FloatBorder" },

-- TelescopeBorder = "FloatBorder",
-- TelescopePromptBorder = "TelescopeBorder",
Expand Down
Loading