Skip to content

Commit 93ad6c2

Browse files
Move FG and BG constants alongside the other constants to remove code duplication
1 parent a59f2f1 commit 93ad6c2

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

crates/anstyle-svg/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ impl Term {
9595
use std::fmt::Write as _;
9696
use unicode_width::UnicodeWidthStr as _;
9797

98-
const FG: &str = "fg";
99-
const BG: &str = "bg";
100-
10198
let mut styled = adapter::AnsiBytes::new();
10299
let mut elements = styled.extract_next(ansi.as_bytes()).collect::<Vec<_>>();
103100
preprocess_invert_style(&mut elements, self.bg_color, self.fg_color);
@@ -215,9 +212,6 @@ impl Term {
215212
pub fn render_html(&self, ansi: &str) -> String {
216213
use std::fmt::Write as _;
217214

218-
const FG: &str = "fg";
219-
const BG: &str = "bg";
220-
221215
let mut styled = adapter::AnsiBytes::new();
222216
let mut elements = styled.extract_next(ansi.as_bytes()).collect::<Vec<_>>();
223217
preprocess_invert_style(&mut elements, self.bg_color, self.fg_color);
@@ -515,6 +509,8 @@ fn rgb_value(color: anstyle::Color, palette: Palette) -> String {
515509
format!("#{r:02X}{g:02X}{b:02X}")
516510
}
517511

512+
const FG: &str = "fg";
513+
const BG: &str = "bg";
518514
const FG_PREFIX: &str = "fg";
519515
const BG_PREFIX: &str = "bg";
520516
const UNDERLINE_PREFIX: &str = "underline";

0 commit comments

Comments
 (0)