Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit cdd737a

Browse files
committed
fix intense
1 parent 4f19151 commit cdd737a

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

examples/cli.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,26 @@ fn main() -> Result<(), failure::Error> {
2222
.underline(true)
2323
.bold(true)
2424
.intense(true)
25-
.add_item(text("hello")),
25+
.add_item(text("mixed style")),
2626
)?;
2727

28+
out.print(
29+
&span()
30+
.intense(true)
31+
.fg("green")?
32+
.add_item(text("color with intense")),
33+
)?;
34+
35+
out.print(
36+
&span()
37+
.intense(false)
38+
.fg("green")?
39+
.add_item(text("color without intense")),
40+
)?;
41+
42+
out.print(&span().bold(true).add_item(text("bold")))?;
43+
44+
out.print(&span().underline(true).add_item(text("underline")))?;
45+
2846
Ok(())
2947
}

src/components/span.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ impl Render for Span {
101101
.set_fg(self.fg)
102102
.set_bg(self.bg)
103103
.set_bold(self.bold)
104-
.set_underline(self.underline),
104+
.set_underline(self.underline)
105+
.set_intense(self.intense),
105106
)?;
106107
for item in &self.items {
107108
item.render_for_humans(fmt)?;
@@ -152,8 +153,7 @@ mod test {
152153
.unwrap()
153154
.bg("blue")
154155
.unwrap(),
155-
)
156-
.unwrap();
156+
).unwrap();
157157
assert_eq!(
158158
test_target.to_string(),
159159
"\u{1b}[0m\u{1b}[32m\u{1b}[44mhello\u{1b}[0m\n"
@@ -175,8 +175,12 @@ mod test {
175175
fn test_intense_output() {
176176
let test_target = human::test_with_color();
177177
let mut out = ::new().add_target(test_target.target());
178-
out.print(span().add_item("hello").intense(true)).unwrap();
179-
assert_eq!(test_target.to_string(), "\u{1b}[0mhello\u{1b}[0m\n")
178+
out.print(span().add_item("hello").fg("green").unwrap().intense(true))
179+
.unwrap();
180+
assert_eq!(
181+
test_target.to_string(),
182+
"\u{1b}[0m\u{1b}[38;5;10mhello\u{1b}[0m\n"
183+
)
180184
}
181185

182186
#[test]

0 commit comments

Comments
 (0)