diff --git a/README.md b/README.md index a067c24..f6a25b4 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,8 @@ layout { | `timezone1` | `"name/offset"` | `"UTC/0"` | | | `timezone[2-9]` | `"name/offset"` | - | | | `default_timezone` | `"name"` | `"UTC"` | | +| `date_format` | [chrono::format::strftime](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) | `%Y-%m-%d %a` | | +| `time_format` | [chrono::format::strftime](https://docs.rs/chrono/latest/chrono/format/strftime/index.html) | `%H:%M` | | | `background_color` | `"#color"` | `"#0080a0"` | | | `foreground_color` | `"#color"` | `"#ffffff"` | It may be adjusted automatically depending on the `background_color`. | | `pane_color` | `"#color"` | `"#1e1e1e"` | | diff --git a/src/config.rs b/src/config.rs index 191bf12..6c93806 100644 --- a/src/config.rs +++ b/src/config.rs @@ -11,6 +11,8 @@ static DEFAULT_ARROW_SEPARATOR_1: &str = ""; static DEFAULT_ARROW_SEPARATOR_2: &str = ""; static DEFAULT_ARROW_SEPARATOR_3: &str = ""; static DEFAULT_TEXT_ALIGN: &str = "right"; +static DEFAULT_DATE_FORMAT: &str = "%Y-%m-%d %a"; +static DEFAULT_TIME_ALIGN: &str = "%H:%M"; pub struct Config { timezone: LinkedHashMap, @@ -35,8 +37,8 @@ impl Default for Config { Config { timezone, default_timezone: default_timezone.to_string(), - date_format: "%Y-%m-%d %a".to_string(), - time_format: "%H:%M".to_string(), + date_format: DEFAULT_DATE_FORMAT.to_string(), + time_format: DEFAULT_TIME_ALIGN.to_string(), background_color: parse_color(DEFAULT_BACKGROUND_COLOR).unwrap(), foreground_color: parse_color(DEFAULT_FOREGROUND_COLOR).unwrap(), pane_color: parse_color(DEFAULT_PANE_COLOR).unwrap(),