Skip to content

Commit

Permalink
feat: add text effects (Framed, Encircled, Overlined)
Browse files Browse the repository at this point in the history
Merge pull request #59 from elegantShock2258/main
  • Loading branch information
dialex authored Sep 25, 2021
2 parents 19b943a + 4d5e1e3 commit b4bb05a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/diogonunes/jcolor/Attribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ public static Attribute HIDDEN() {
public static Attribute STRIKETHROUGH() {
return new SimpleAttribute("9");
}

public static Attribute FRAMED() {
return new SimpleAttribute("51");
}

public static Attribute ENCIRCLED() {
return new SimpleAttribute("52");
}

public static Attribute OVERLINED() {
return new SimpleAttribute("53");
}

// Colors (foreground)

Expand Down
39 changes: 39 additions & 0 deletions src/test/java/com/diogonunes/jcolor/tests/unit/TestAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,45 @@ public void Attribute_AnsiCode_Strikethrough() {
assertThat(code, equalTo(expectedAnsiCode));
}

@Test
public void Attribute_AnsiCode_Framed() {
// ARRANGE
Attribute attribute = Attribute.FRAMED();

// ACT
String code = attribute.toString();

// ASSERT
String expectedAnsiCode = "51";
assertThat(code, equalTo(expectedAnsiCode));
}

@Test
public void Attribute_AnsiCode_Encircled() {
// ARRANGE
Attribute attribute = Attribute.ENCIRCLED();

// ACT
String code = attribute.toString();

// ASSERT
String expectedAnsiCode = "52";
assertThat(code, equalTo(expectedAnsiCode));
}

@Test
public void Attribute_AnsiCode_Overlined() {
// ARRANGE
Attribute attribute = Attribute.OVERLINED();

// ACT
String code = attribute.toString();

// ASSERT
String expectedAnsiCode = "53";
assertThat(code, equalTo(expectedAnsiCode));
}

// Colors (foreground)

@Test
Expand Down

0 comments on commit b4bb05a

Please sign in to comment.