Skip to content

Commit

Permalink
refactor(theme): rename selection to selected_item
Browse files Browse the repository at this point in the history
Renamed `selection` to `selected_item` in theme configuration files
and related Rust source files. This change improves clarity and
consistency in naming conventions across the codebase. Updated
`example/config.yaml`, `src/config/theme/list.rs`, and
`src/config/theme/widget.rs` accordingly.
  • Loading branch information
sarub0b0 committed Jan 4, 2025
1 parent b581fcf commit da4253a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ theme:
query:
fg_color: yellow

selection:
## Highlight the selected item
selected_item:
fg_color: green
modifier: reversed

Expand Down
8 changes: 4 additions & 4 deletions src/config/theme/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pub struct ListThemeConfig {
#[serde(default)]
pub filter: FilterFormThemeConfig,

#[serde(default = "default_selection")]
pub selection: ThemeStyleConfig,
#[serde(default = "default_selected_item")]
pub selected_item: ThemeStyleConfig,

#[serde(default)]
pub status: ThemeStyleConfig,
Expand All @@ -18,14 +18,14 @@ pub struct ListThemeConfig {
impl Default for ListThemeConfig {
fn default() -> ListThemeConfig {
ListThemeConfig {
selection: default_selection(),
selected_item: default_selected_item(),
filter: FilterFormThemeConfig::default(),
status: Default::default(),
}
}
}

fn default_selection() -> ThemeStyleConfig {
fn default_selected_item() -> ThemeStyleConfig {
ThemeStyleConfig {
modifier: Modifier::REVERSED,
..Default::default()
Expand Down
10 changes: 5 additions & 5 deletions src/config/theme/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl From<WidgetThemeConfig> for single_select::FilterFormTheme {
impl From<WidgetThemeConfig> for ListTheme {
fn from(theme: WidgetThemeConfig) -> Self {
Self {
selected: theme.list.selection.into(),
selected: theme.list.selected_item.into(),
}
}
}
Expand Down Expand Up @@ -325,7 +325,7 @@ mod tests {
..Default::default()
},
},
selection: ThemeStyleConfig {
selected_item: ThemeStyleConfig {
fg_color: Some(Color::Green),
modifier: Modifier::REVERSED,
..Default::default()
Expand Down Expand Up @@ -423,7 +423,7 @@ mod tests {
fg_color: white
query:
fg_color: white
selection:
selected_item:
fg_color: green
modifier: reversed
status:
Expand Down Expand Up @@ -509,7 +509,7 @@ mod tests {
fg_color: white
query:
fg_color: white
selection:
selected_item:
fg_color: green
modifier: reversed
status:
Expand Down Expand Up @@ -645,7 +645,7 @@ mod tests {
..Default::default()
},
},
selection: ThemeStyleConfig {
selected_item: ThemeStyleConfig {
fg_color: Some(Color::Green),
modifier: Modifier::REVERSED,
..Default::default()
Expand Down

0 comments on commit da4253a

Please sign in to comment.