add config for customizing the tabs and new tab button
```lua
local wezterm = require 'wezterm';
-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)
return {
tab_bar_style = {
active_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_LEFT_ARROW},
}),
active_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_RIGHT_ARROW},
}),
inactive_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_LEFT_ARROW},
}),
inactive_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_RIGHT_ARROW},
}),
}
}
```
2021-03-12 08:21:31 +03:00
|
|
|
use crate::lua::{format_as_escapes, FormatItem};
|
2020-10-02 21:50:50 +03:00
|
|
|
use crate::*;
|
|
|
|
use luahelper::impl_lua_conversion;
|
2019-11-24 18:55:13 +03:00
|
|
|
use termwiz::cell::CellAttributes;
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
pub use termwiz::color::{ColorSpec, RgbColor};
|
2019-11-24 18:44:17 +03:00
|
|
|
|
2021-02-19 19:28:19 +03:00
|
|
|
#[derive(Debug, Copy, Deserialize, Serialize, Clone)]
|
wezterm: revise opacity configuration
This commit revises the opacity configuration to make it more
consistently applied.
* `window_background_opacity` controls the overall window capacity,
whether a background image is present or not.
* When a background image is present, or if the window is transparent,
then text whose background color is the default background is
changed to have a fully transparent background.
* `text_background_opacity` controls the alpha channel value for
text whose background color is NOT the default background.
It defaults to 1.0 (fully opaque), but can be set to be
transparent by setting it to a number between 0.0 and 1.0.
* The inactive pane hue, saturation, brightness multipliers
have been factored out into their own struct which changes
that set of options to:
```lua
return {
inactive_pane_hsb = {
hue = 1.0,
saturation = 1.0,
brightness = 1.0,
},
}
```
* `window_background_image_hsb` is a new option that can apply
a hue, saturation, brightness transformation to a background
image. This is primarily useful to make a background image
darker:
```lua
return {
window_background_image = "/some/pic.png",
window_background_image_hsb = {
brightness = 0.3,
},
}
```
refs: #302
refs: #297
2020-10-24 09:16:00 +03:00
|
|
|
pub struct HsbTransform {
|
|
|
|
#[serde(default = "default_one_point_oh")]
|
|
|
|
pub hue: f32,
|
|
|
|
#[serde(default = "default_one_point_oh")]
|
|
|
|
pub saturation: f32,
|
|
|
|
#[serde(default = "default_one_point_oh")]
|
|
|
|
pub brightness: f32,
|
|
|
|
}
|
|
|
|
|
2021-02-19 19:28:19 +03:00
|
|
|
impl Default for HsbTransform {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
hue: 1.,
|
|
|
|
saturation: 1.,
|
|
|
|
brightness: 1.,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-21 21:03:32 +03:00
|
|
|
fn de_indexed<'de, D>(deserializer: D) -> Result<HashMap<u8, RgbColor>, D::Error>
|
|
|
|
where
|
|
|
|
D: Deserializer<'de>,
|
|
|
|
{
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
struct Wrap(HashMap<String, RgbColor>);
|
|
|
|
let Wrap(map) = Wrap::deserialize(deserializer)?;
|
|
|
|
|
|
|
|
Ok(map
|
|
|
|
.into_iter()
|
|
|
|
.filter_map(|(k, v)| match k.parse::<u8>() {
|
|
|
|
Ok(n) if n >= 16 => Some((n, v)),
|
|
|
|
_ => {
|
|
|
|
log::warn!("Ignoring invalid color key {}", k);
|
|
|
|
None
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.collect())
|
|
|
|
}
|
|
|
|
|
2020-12-19 21:08:41 +03:00
|
|
|
#[derive(Default, Debug, Deserialize, Serialize, Clone)]
|
2019-11-24 18:44:17 +03:00
|
|
|
pub struct Palette {
|
|
|
|
/// The text color to use when the attributes are reset to default
|
|
|
|
pub foreground: Option<RgbColor>,
|
|
|
|
/// The background color to use when the attributes are reset to default
|
|
|
|
pub background: Option<RgbColor>,
|
|
|
|
/// The color of the cursor
|
|
|
|
pub cursor_fg: Option<RgbColor>,
|
|
|
|
pub cursor_bg: Option<RgbColor>,
|
2019-12-22 23:58:07 +03:00
|
|
|
pub cursor_border: Option<RgbColor>,
|
2019-11-24 18:44:17 +03:00
|
|
|
/// The color of selected text
|
|
|
|
pub selection_fg: Option<RgbColor>,
|
|
|
|
pub selection_bg: Option<RgbColor>,
|
|
|
|
/// A list of 8 colors corresponding to the basic ANSI palette
|
|
|
|
pub ansi: Option<[RgbColor; 8]>,
|
|
|
|
/// A list of 8 colors corresponding to bright versions of the
|
|
|
|
/// ANSI palette
|
|
|
|
pub brights: Option<[RgbColor; 8]>,
|
2021-08-21 14:46:52 +03:00
|
|
|
/// A map for setting arbitrary colors ranging from 16 to 256 in the color
|
|
|
|
/// palette
|
2021-08-21 21:03:32 +03:00
|
|
|
#[serde(default, deserialize_with = "de_indexed")]
|
|
|
|
pub indexed: HashMap<u8, RgbColor>,
|
2019-11-24 18:44:17 +03:00
|
|
|
/// Configure the colors and styling of the tab bar
|
|
|
|
pub tab_bar: Option<TabBarColors>,
|
2019-12-23 05:57:54 +03:00
|
|
|
/// The color of the "thumb" of the scrollbar; the segment that
|
|
|
|
/// represents the current viewable area
|
|
|
|
pub scrollbar_thumb: Option<RgbColor>,
|
2020-10-20 08:03:21 +03:00
|
|
|
/// The color of the split line between panes
|
|
|
|
pub split: Option<RgbColor>,
|
2021-09-25 22:40:22 +03:00
|
|
|
/// The color of the visual bell. If unspecified, the foreground
|
|
|
|
/// color is used instead.
|
|
|
|
pub visual_bell: Option<RgbColor>,
|
2019-11-24 18:44:17 +03:00
|
|
|
}
|
2020-03-01 21:55:17 +03:00
|
|
|
impl_lua_conversion!(Palette);
|
2019-11-24 18:44:17 +03:00
|
|
|
|
2020-06-13 19:04:13 +03:00
|
|
|
impl From<Palette> for wezterm_term::color::ColorPalette {
|
|
|
|
fn from(cfg: Palette) -> wezterm_term::color::ColorPalette {
|
|
|
|
let mut p = wezterm_term::color::ColorPalette::default();
|
2019-11-24 18:44:17 +03:00
|
|
|
macro_rules! apply_color {
|
|
|
|
($name:ident) => {
|
|
|
|
if let Some($name) = cfg.$name {
|
|
|
|
p.$name = $name;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
apply_color!(foreground);
|
|
|
|
apply_color!(background);
|
|
|
|
apply_color!(cursor_fg);
|
|
|
|
apply_color!(cursor_bg);
|
2019-12-22 23:58:07 +03:00
|
|
|
apply_color!(cursor_border);
|
2019-11-24 18:44:17 +03:00
|
|
|
apply_color!(selection_fg);
|
|
|
|
apply_color!(selection_bg);
|
2019-12-23 05:57:54 +03:00
|
|
|
apply_color!(scrollbar_thumb);
|
2020-10-20 08:03:21 +03:00
|
|
|
apply_color!(split);
|
2019-11-24 18:44:17 +03:00
|
|
|
|
|
|
|
if let Some(ansi) = cfg.ansi {
|
|
|
|
for (idx, col) in ansi.iter().enumerate() {
|
|
|
|
p.colors.0[idx] = *col;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if let Some(brights) = cfg.brights {
|
|
|
|
for (idx, col) in brights.iter().enumerate() {
|
|
|
|
p.colors.0[idx + 8] = *col;
|
|
|
|
}
|
|
|
|
}
|
2021-08-22 11:10:38 +03:00
|
|
|
for (&idx, &col) in &cfg.indexed {
|
|
|
|
p.colors.0[idx as usize] = col;
|
2021-08-21 14:46:52 +03:00
|
|
|
}
|
2019-11-24 18:44:17 +03:00
|
|
|
p
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Specify the text styling for a tab in the tab bar
|
2020-03-01 21:55:17 +03:00
|
|
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
2019-11-24 18:44:17 +03:00
|
|
|
pub struct TabBarColor {
|
|
|
|
/// Specifies the intensity attribute for the tab title text
|
|
|
|
#[serde(default)]
|
2020-06-13 19:04:13 +03:00
|
|
|
pub intensity: wezterm_term::Intensity,
|
2019-11-24 18:44:17 +03:00
|
|
|
/// Specifies the underline attribute for the tab title text
|
|
|
|
#[serde(default)]
|
2020-06-13 19:04:13 +03:00
|
|
|
pub underline: wezterm_term::Underline,
|
2019-11-24 18:44:17 +03:00
|
|
|
/// Specifies the italic attribute for the tab title text
|
|
|
|
#[serde(default)]
|
|
|
|
pub italic: bool,
|
|
|
|
/// Specifies the strikethrough attribute for the tab title text
|
|
|
|
#[serde(default)]
|
|
|
|
pub strikethrough: bool,
|
|
|
|
/// The background color for the tab
|
|
|
|
pub bg_color: RgbColor,
|
|
|
|
/// The forgeground/text color for the tab
|
|
|
|
pub fg_color: RgbColor,
|
|
|
|
}
|
2020-03-01 21:55:17 +03:00
|
|
|
impl_lua_conversion!(TabBarColor);
|
2019-11-24 18:44:17 +03:00
|
|
|
|
|
|
|
impl TabBarColor {
|
|
|
|
pub fn as_cell_attributes(&self) -> CellAttributes {
|
|
|
|
let mut attr = CellAttributes::default();
|
|
|
|
attr.set_intensity(self.intensity)
|
|
|
|
.set_underline(self.underline)
|
|
|
|
.set_italic(self.italic)
|
|
|
|
.set_strikethrough(self.strikethrough)
|
|
|
|
.set_background(ColorSpec::TrueColor(self.bg_color))
|
|
|
|
.set_foreground(ColorSpec::TrueColor(self.fg_color));
|
|
|
|
attr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Specifies the colors to use for the tab bar portion of the UI.
|
|
|
|
/// These are not part of the terminal model and cannot be updated
|
|
|
|
/// in the same way that the dynamic color schemes are.
|
2020-03-01 21:55:17 +03:00
|
|
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
2019-11-24 18:44:17 +03:00
|
|
|
pub struct TabBarColors {
|
|
|
|
/// The background color for the tab bar
|
2020-02-09 20:34:59 +03:00
|
|
|
#[serde(default = "default_background")]
|
2019-11-24 18:44:17 +03:00
|
|
|
pub background: RgbColor,
|
|
|
|
|
|
|
|
/// Styling for the active tab
|
2020-02-09 20:34:59 +03:00
|
|
|
#[serde(default = "default_active_tab")]
|
2019-11-24 18:44:17 +03:00
|
|
|
pub active_tab: TabBarColor,
|
2020-02-09 20:34:59 +03:00
|
|
|
|
2019-11-24 18:44:17 +03:00
|
|
|
/// Styling for other inactive tabs
|
2020-02-09 20:34:59 +03:00
|
|
|
#[serde(default = "default_inactive_tab")]
|
2019-11-24 18:44:17 +03:00
|
|
|
pub inactive_tab: TabBarColor,
|
2020-02-09 20:34:59 +03:00
|
|
|
|
2019-11-24 18:44:17 +03:00
|
|
|
/// Styling for an inactive tab with a mouse hovering
|
2020-02-09 20:34:59 +03:00
|
|
|
#[serde(default = "default_inactive_tab_hover")]
|
2019-11-24 18:44:17 +03:00
|
|
|
pub inactive_tab_hover: TabBarColor,
|
2021-07-17 18:31:11 +03:00
|
|
|
|
|
|
|
/// Styling for the new tab button
|
|
|
|
#[serde(default = "default_inactive_tab")]
|
|
|
|
pub new_tab: TabBarColor,
|
|
|
|
|
|
|
|
/// Styling for the new tab button with a mouse hovering
|
|
|
|
#[serde(default = "default_inactive_tab_hover")]
|
|
|
|
pub new_tab_hover: TabBarColor,
|
2019-11-24 18:44:17 +03:00
|
|
|
}
|
2020-03-01 21:55:17 +03:00
|
|
|
impl_lua_conversion!(TabBarColors);
|
2019-11-24 18:44:17 +03:00
|
|
|
|
2020-02-09 20:34:59 +03:00
|
|
|
fn default_background() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0x0b, 0x00, 0x22)
|
2020-02-09 20:34:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_inactive_tab() -> TabBarColor {
|
|
|
|
TabBarColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
bg_color: RgbColor::new_8bpc(0x1b, 0x10, 0x32),
|
|
|
|
fg_color: RgbColor::new_8bpc(0x80, 0x80, 0x80),
|
2020-02-09 20:34:59 +03:00
|
|
|
..TabBarColor::default()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fn default_inactive_tab_hover() -> TabBarColor {
|
|
|
|
TabBarColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
bg_color: RgbColor::new_8bpc(0x3b, 0x30, 0x52),
|
|
|
|
fg_color: RgbColor::new_8bpc(0x90, 0x90, 0x90),
|
2020-02-09 20:34:59 +03:00
|
|
|
italic: true,
|
|
|
|
..TabBarColor::default()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fn default_active_tab() -> TabBarColor {
|
|
|
|
TabBarColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
bg_color: RgbColor::new_8bpc(0x2b, 0x20, 0x42),
|
|
|
|
fg_color: RgbColor::new_8bpc(0xc0, 0xc0, 0xc0),
|
2020-02-09 20:34:59 +03:00
|
|
|
..TabBarColor::default()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 18:44:17 +03:00
|
|
|
impl Default for TabBarColors {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
2020-02-09 20:34:59 +03:00
|
|
|
background: default_background(),
|
|
|
|
inactive_tab: default_inactive_tab(),
|
|
|
|
inactive_tab_hover: default_inactive_tab_hover(),
|
|
|
|
active_tab: default_active_tab(),
|
2021-07-17 18:31:11 +03:00
|
|
|
new_tab: default_inactive_tab(),
|
|
|
|
new_tab_hover: default_inactive_tab_hover(),
|
2019-11-24 18:44:17 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-13 08:40:30 +03:00
|
|
|
|
add config for customizing the tabs and new tab button
```lua
local wezterm = require 'wezterm';
-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)
return {
tab_bar_style = {
active_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_LEFT_ARROW},
}),
active_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_RIGHT_ARROW},
}),
inactive_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_LEFT_ARROW},
}),
inactive_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_RIGHT_ARROW},
}),
}
}
```
2021-03-12 08:21:31 +03:00
|
|
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
|
|
pub struct TabBarStyle {
|
2021-07-17 18:31:11 +03:00
|
|
|
#[serde(default = "default_new_tab")]
|
|
|
|
pub new_tab: String,
|
|
|
|
#[serde(default = "default_new_tab")]
|
|
|
|
pub new_tab_hover: String,
|
add config for customizing the tabs and new tab button
```lua
local wezterm = require 'wezterm';
-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)
return {
tab_bar_style = {
active_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_LEFT_ARROW},
}),
active_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_RIGHT_ARROW},
}),
inactive_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_LEFT_ARROW},
}),
inactive_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_RIGHT_ARROW},
}),
}
}
```
2021-03-12 08:21:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for TabBarStyle {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
2021-07-17 18:31:11 +03:00
|
|
|
new_tab: default_new_tab(),
|
|
|
|
new_tab_hover: default_new_tab(),
|
add config for customizing the tabs and new tab button
```lua
local wezterm = require 'wezterm';
-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)
return {
tab_bar_style = {
active_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_LEFT_ARROW},
}),
active_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_RIGHT_ARROW},
}),
inactive_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_LEFT_ARROW},
}),
inactive_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_RIGHT_ARROW},
}),
}
}
```
2021-03-12 08:21:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-17 18:31:11 +03:00
|
|
|
fn default_new_tab() -> String {
|
|
|
|
format_as_escapes(vec![FormatItem::Text(" + ".to_string())]).unwrap()
|
add config for customizing the tabs and new tab button
```lua
local wezterm = require 'wezterm';
-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)
return {
tab_bar_style = {
active_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_LEFT_ARROW},
}),
active_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#2b2042"}},
{Text=SOLID_RIGHT_ARROW},
}),
inactive_tab_left = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_LEFT_ARROW},
}),
inactive_tab_right = wezterm.format({
{Background={Color="#0b0022"}},
{Foreground={Color="#1b1032"}},
{Text=SOLID_RIGHT_ARROW},
}),
}
}
```
2021-03-12 08:21:31 +03:00
|
|
|
}
|
|
|
|
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
|
|
|
pub struct WindowFrameConfig {
|
|
|
|
#[serde(default = "default_inactive_titlebar_bg")]
|
|
|
|
pub inactive_titlebar_bg: RgbColor,
|
|
|
|
#[serde(default = "default_active_titlebar_bg")]
|
|
|
|
pub active_titlebar_bg: RgbColor,
|
|
|
|
#[serde(default = "default_inactive_titlebar_fg")]
|
|
|
|
pub inactive_titlebar_fg: RgbColor,
|
|
|
|
#[serde(default = "default_active_titlebar_fg")]
|
|
|
|
pub active_titlebar_fg: RgbColor,
|
|
|
|
#[serde(default = "default_inactive_titlebar_border_bottom")]
|
|
|
|
pub inactive_titlebar_border_bottom: RgbColor,
|
|
|
|
#[serde(default = "default_active_titlebar_border_bottom")]
|
|
|
|
pub active_titlebar_border_bottom: RgbColor,
|
|
|
|
#[serde(default = "default_button_fg")]
|
|
|
|
pub button_fg: RgbColor,
|
|
|
|
#[serde(default = "default_button_bg")]
|
|
|
|
pub button_bg: RgbColor,
|
|
|
|
#[serde(default = "default_button_hover_fg")]
|
|
|
|
pub button_hover_fg: RgbColor,
|
|
|
|
#[serde(default = "default_button_hover_bg")]
|
|
|
|
pub button_hover_bg: RgbColor,
|
2021-06-27 23:04:20 +03:00
|
|
|
|
|
|
|
#[serde(default = "default_title_font")]
|
|
|
|
pub font: TextStyle,
|
|
|
|
#[serde(default = "default_title_font_size", deserialize_with = "de_number")]
|
|
|
|
pub font_size: f64,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn default_title_font_size() -> f64 {
|
2021-10-09 05:30:40 +03:00
|
|
|
12.
|
2021-06-27 23:04:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_title_font() -> TextStyle {
|
2021-10-09 18:12:26 +03:00
|
|
|
fn bold(family: &str) -> FontAttributes {
|
|
|
|
FontAttributes {
|
|
|
|
family: family.to_string(),
|
2021-10-09 05:30:40 +03:00
|
|
|
weight: FontWeight::BOLD,
|
|
|
|
..Default::default()
|
2021-10-09 18:12:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let mut fonts = vec![if cfg!(target_os = "macos") {
|
|
|
|
// "SF Pro" or one of the San Francisco font variants
|
|
|
|
// are the official fonts for the macOS UI, but those
|
|
|
|
// are not directly accessible to non-Apple applications,
|
|
|
|
// and have a restricted license.
|
|
|
|
// Wikipedia says that `Galvji` looks very similar,
|
|
|
|
// but has slightly different spacing.
|
|
|
|
// It's close enough for me!
|
|
|
|
bold("Galvji")
|
|
|
|
} else if cfg!(windows) {
|
|
|
|
bold("Segoe UI")
|
|
|
|
} else {
|
|
|
|
bold("Cantarell")
|
|
|
|
}];
|
|
|
|
|
|
|
|
if !cfg!(windows) && !cfg!(target_os = "macos") {
|
|
|
|
fonts.push(bold("DejaVu Sans"));
|
|
|
|
}
|
|
|
|
|
|
|
|
TextStyle {
|
|
|
|
foreground: None,
|
|
|
|
font: fonts,
|
2021-06-27 23:04:20 +03:00
|
|
|
}
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for WindowFrameConfig {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
inactive_titlebar_bg: default_inactive_titlebar_bg(),
|
|
|
|
active_titlebar_bg: default_active_titlebar_bg(),
|
|
|
|
inactive_titlebar_fg: default_inactive_titlebar_fg(),
|
|
|
|
active_titlebar_fg: default_active_titlebar_fg(),
|
|
|
|
inactive_titlebar_border_bottom: default_inactive_titlebar_border_bottom(),
|
|
|
|
active_titlebar_border_bottom: default_active_titlebar_border_bottom(),
|
|
|
|
button_fg: default_button_fg(),
|
|
|
|
button_bg: default_button_bg(),
|
|
|
|
button_hover_fg: default_button_hover_fg(),
|
|
|
|
button_hover_bg: default_button_hover_bg(),
|
2021-06-27 23:04:20 +03:00
|
|
|
font: default_title_font(),
|
|
|
|
font_size: default_font_size(),
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn default_inactive_titlebar_bg() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0x35, 0x35, 0x35)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_active_titlebar_bg() -> RgbColor {
|
2021-10-04 08:00:28 +03:00
|
|
|
RgbColor::new_8bpc(0x29, 0x29, 0x29)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_inactive_titlebar_fg() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0xcc, 0xcc, 0xcc)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_active_titlebar_fg() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0xff, 0xff, 0xff)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_inactive_titlebar_border_bottom() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0x2b, 0x20, 0x42)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_active_titlebar_border_bottom() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0x2b, 0x20, 0x42)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_button_hover_fg() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0xff, 0xff, 0xff)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_button_fg() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0xcc, 0xcc, 0xcc)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_button_hover_bg() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0x3b, 0x30, 0x52)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn default_button_bg() -> RgbColor {
|
2021-07-11 00:16:57 +03:00
|
|
|
RgbColor::new_8bpc(0x2b, 0x20, 0x42)
|
wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color
```lua
return {
window_frame = {
inactive_titlebar_bg = "",
active_titlebar_bg = "",
inactive_titlebar_fg = "",
active_titlebar_fg = "",
inactive_titlebar_border_bottom = "",
active_titlebar_border_bottom = "",
button_fg = "",
button_bg = "",
button_hover_fg = "",
button_hover_bg = "",
}
}
```
refs: https://github.com/wez/wezterm/issues/761
2021-06-27 22:19:42 +03:00
|
|
|
}
|
|
|
|
|
2020-03-01 21:55:17 +03:00
|
|
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
2020-01-13 08:40:30 +03:00
|
|
|
pub struct ColorSchemeFile {
|
|
|
|
/// The color palette
|
|
|
|
pub colors: Palette,
|
|
|
|
}
|
2020-03-01 21:55:17 +03:00
|
|
|
impl_lua_conversion!(ColorSchemeFile);
|