From 016a20711ee595a11426f9c1f4ab3e04967df553 Mon Sep 17 00:00:00 2001 From: Michael Lan <44309097+mizlan@users.noreply.github.com> Date: Sun, 20 Feb 2022 18:05:43 -0800 Subject: [PATCH] feat: ayu adaptive background (#584) * feat: Enable adaptive theme for ayu theme * Update description of ayu theme * doc: make formatting consistent --- THEMES.md | 7 +++++-- lua/lualine/themes/ayu.lua | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/THEMES.md b/THEMES.md index 2cc3a9c..917b517 100644 --- a/THEMES.md +++ b/THEMES.md @@ -40,8 +40,11 @@ it'll try it's best to generate one.
### ayu -It's a combination of ayu_light, ayu_dark & ayu_mirage. It loads one of these -them based you your `g:ayucolor` option. +It's a combination of ayu_light, ayu_dark & ayu_mirage. If `g:ayucolor` exists, +it loads one of these based on your `g:ayucolor` option. Otherwise, it will +load ayu_light when background=light and ayu_dark when background=dark +But if `g:ayuprefermirage` exists, it will load ayu_mirage instead when +`background=dark`. ### codedarkdiff --git a/lua/lualine/themes/ayu.lua b/lua/lualine/themes/ayu.lua index 380e3a4..b784306 100644 --- a/lua/lualine/themes/ayu.lua +++ b/lua/lualine/themes/ayu.lua @@ -2,6 +2,7 @@ -- MIT license, see LICENSE for more details. -- Credit: itchyny(lightline) -- License: MIT License -local style = vim.g.ayucolor or 'dark' +local background = vim.opt.background:get() +local style = vim.g.ayucolor or ((background == 'dark') and vim.g.ayuprefermirage and 'mirage' or background) return require('lualine.themes.ayu_' .. style)