Class jm_Ansi._ansi
- Enclosing class:
- jm_Ansi
This class is where all of the formatting happens. Acquire an instance via
jm_Ansi.make()
or jm_Ansi.make(String)
where you can use cascading to create formatting.
For 4bit colors you should check out: https://i.stack.imgur.com/9UVnC.png
[!] You must always be aware that colors look different depending on the system!- Author:
- Jack Meng
-
Method Summary
Modifier and TypeMethodDescriptionappend
(boolean b) Extracted methodappend
(char b) Extracted methodappend
(char[] b) Extracted methodappend
(char[] b, int offset, int len) Extracted methodappend
(double b) Extracted methodappend
(float b) Extracted methodappend
(int b) Extracted methodappend
(long b) Extracted methodExtracted methodappend
(CharSequence b, int start, int end) Extracted methodExtracted methodExtracted methodExtracted methodapply
(int... i) Apply your own custom list of ANSI codes.bg()
Mostly used for internal creation of colors.black()
Callsblack_fg()
black_bg()
black_fg()
blue()
Callsblue_fg()
blue_bg()
blue_fg()
bold()
Callsbright_blue_fg()
Callsbright_cyan_fg()
Callsbright_green_fg()
Callsbright_magenta_fg()
Callsbright_red_fg()
Callsbright_yellow_fg()
content()
Get what is currently treated as raw content in this builder.cyan()
Callscyan_fg()
cyan_bg()
cyan_fg()
NOTE: On certain renderers, bright_black_fg and bright_black_bg will return the same colors as black_fg and black_bg respectively.delete
(int start, int end) Extracted methoddeleteCharAt
(int index) Extracted methodend()
Should not be called by the programmer unless absolutely necessary.escaped()
For debugging purposes.faint()
Not widely supportedfg()
Mostly used for internal creation of colors.font_1()
font_2()
font_3()
font_4()
font_5()
font_6()
font_7()
font_8()
font_9()
fraktur()
Unsupported.framed()
void
getChars
(int srcBegin, int srcEnd, char[] dst, int dstBegin) Extracted methodgray()
NOTE: On certain renderers, white_fg and white_bg will return a GRAY color, while on some it returns WHITE! Callswhite_fg()
green()
Callsgreen_fg()
green_bg()
green_fg()
hide()
Hides the text.int
Extracted methodint
Extracted methodinsert
(int offset, boolean b) Extracted methodinsert
(int offset, char b) Extracted methodinsert
(int offset, char[] b) Extracted methodinsert
(int index, char[] b, int offset, int len) Extracted methodinsert
(int offset, double b) Extracted methodinsert
(int offset, float b) Extracted methodinsert
(int offset, int b) Extracted methodinsert
(int offset, long b) Extracted methodinsert
(int dstOffset, CharSequence s) Extracted methodinsert
(int dstOffset, CharSequence s, int start, int end) Extracted methodExtracted methodExtracted methoditalic()
Not widely supported.int
lastIndexOf
(String str) Extracted methodint
lastIndexOf
(String str, int fromIndex) Extracted methodint
length()
Extracted methodmagenta()
Callsmagenta_fg()
make
(int... codes) no_blink()
no_bold()
Sometimes treated as double underline.no_hide()
no_fraktur as wellBoth single and double underlines eliminatednormal()
No bold or low thicknessprimary()
Regular font effectsprint()
Uses the default {@link System#out#print()}print
(PrintStream e) print
(PrintStream ps, String content) Use for end cascading payload submissionprintln()
Uses the default {@link System#out#println()}println
(PrintStream ps, String content) Use for end cascading payload submissionred()
Callsred_fg()
red_bg()
red_fg()
render()
Does not provide a RESET at the end as compared totoString()
ortoString(String)
Extracted methodreset()
Just use jm_Ansi::resetreverse()
Extracted methodrgb_bg
(int[] rgb) rgb_bg
(int r, int g, int b) rgb_fg
(int[] rgb) rgb_fg
(int r, int g, int b) setCharAt
(int index, char ch) Extracted methodsetLength
(int newLength) Extracted methodDoes not conceal.subSequence
(int start, int end) Extracted methodsubstring
(int start) Extracted methodsubstring
(int start, int end) Extracted methodSwaps the foreground and backgroundtoString()
This method also appends a RESET character at the end to reset all ANSI coloring after.Allows for content to be added at the end (either end).Extracted methodwhite()
Callsbright_white_fg()
white_bg()
white_fg()
yellow()
Callsyellow_fg()
-
Method Details
-
content
Get what is currently treated as raw content in this builder. Raw content signifies anything that is TO BE FORMATTED and not the things that do the formatting.
[!] THIS METHOD DESTROYS CASCADING [!]- Returns:
- The raw text to format
-
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
append
Extracted method -
delete
Extracted method -
deleteCharAt
Extracted method -
getChars
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) Extracted method[!] This method destroys cascading! [!]
-
indexOf
Extracted method[!] This method destroys cascading! [!]
-
indexOf
Extracted method[!] This method destroys cascading! [!]
-
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
insert
Extracted method -
lastIndexOf
Extracted method[!] This method destroys cascading! [!]
-
lastIndexOf
Extracted method[!] This method destroys cascading! [!]
-
length
public int length()Extracted method[!] This method destroys cascading! [!]
-
replace
Extracted method -
reverse
Extracted method -
setCharAt
Extracted method -
setLength
Extracted method -
subSequence
Extracted method[!] This method destroys cascading! [!]
-
substring
Extracted method[!] This method destroys cascading! [!]
-
substring
Extracted method[!] This method destroys cascading! [!]
-
trimToSize
Extracted method -
black_fg
-
black
Callsblack_fg()
-
black_bg
-
red_fg
-
red
Callsred_fg()
-
red_bg
-
green_fg
-
green
Callsgreen_fg()
-
green_bg
-
yellow_fg
-
yellow
Callsyellow_fg()
-
yellow_bg
-
blue_fg
-
blue
Callsblue_fg()
-
blue_bg
-
magenta_fg
-
magenta
Callsmagenta_fg()
-
magenta_bg
-
cyan_fg
-
cyan
Callscyan_fg()
-
cyan_bg
-
white_fg
-
gray
NOTE: On certain renderers, white_fg and white_bg will return a GRAY color, while on some it returns WHITE! Callswhite_fg()
-
white_bg
-
bright_black_fg
-
dark_gray
NOTE: On certain renderers, bright_black_fg and bright_black_bg will return the same colors as black_fg and black_bg respectively. Callsbright_black_fg()
-
bright_black_bg
-
bright_red_fg
-
bright_red
Callsbright_red_fg()
-
bright_red_bg
-
bright_green_fg
-
bright_green
Callsbright_green_fg()
-
bright_green_bg
-
bright_yellow_fg
-
bright_yellow
Callsbright_yellow_fg()
-
bright_yellow_bg
-
bright_blue_fg
-
bright_blue
Callsbright_blue_fg()
-
bright_blue_bg
-
bright_magenta_fg
-
bright_magenta
Callsbright_magenta_fg()
-
bright_magenta_bg
-
bright_cyan_fg
-
bright_cyan
Callsbright_cyan_fg()
-
bright_cyan_bg
-
bright_white_fg
-
white
Callsbright_white_fg()
-
bright_white_bg
-
reset
Just use jm_Ansi::reset- Returns:
- _ansi object
-
bold
-
faint
Not widely supported -
italic
Not widely supported. Some renderers treat this as invert the text -
underline
-
blink_slow
-
blink_fast
-
swap_fg_bg
Swaps the foreground and background -
hide
Hides the text. Not widely supported. -
strikethrough
Does not conceal. Not widely supported. -
Regular font effects
-
font_1
-
font_2
-
font_3
-
font_4
-
font_5
-
font_6
-
font_7
-
font_8
-
font_9
-
fraktur
Unsupported. -
no_bold
Sometimes treated as double underline. Both are not widely supported. -
normal
No bold or low thickness -
no_italic
no_fraktur as well -
no_underline
Both single and double underlines eliminated -
no_blink
-
no_inverse
-
no_hide
-
no_strikethrough
-
framed
-
encircled
-
overlined
-
no_framed_no_encircled
-
no_overlined
-
fg
Mostly used for internal creation of colors. You should rarely use this if at all.Tells to treat the following elements (in the ANSI code) as a color for the text's foreground
-
bg
Mostly used for internal creation of colors. You should rarely use this if at all.Tells to treat the following elements (in the ANSI code) as a color for the text's background
-
make
-
rgb_fg
-
rgb_fg
-
rgb_bg
-
rgb_bg
-
apply
Apply your own custom list of ANSI codes. It is not suggested using this unless there are codes outside this builder's range.- Parameters:
i
- ANSI codes (vararg)- Returns:
- Instance for cascading
-
end
Should not be called by the programmer unless absolutely necessary. ThetoString()
andescaped()
all call this method in order to validate the String.This method does not create the final values for rendering
- Returns:
- String -> A validated String for printing.
-
toString
This method also appends a RESET character at the end to reset all ANSI coloring after. Technically this is just a wrapper call totoString(String)
-
toString
Allows for content to be added at the end (either end). This method also appends a RESET character at the end to reset all ANSI coloring after.- Parameters:
content
- the content to append to the original content before returning the string- Returns:
- The formatted content
-
render
Does not provide a RESET at the end as compared totoString()
ortoString(String)
- Returns:
- The finalized string without a rest character
-
escaped
For debugging purposes. Displays the built value by escaping all the necessary components.- Returns:
- String
-
print
-
println
-
print
Uses the default {@link System#out#print()} -
println
Uses the default {@link System#out#println()} -
println
Use for end cascading payload submission- Parameters:
ps
- SuggestedPrintStream
to usecontent
- The payload- Returns:
- The current instance
- Since:
- 1.1
-
print
Use for end cascading payload submission- Parameters:
ps
- SuggestedPrintStream
to usecontent
- The payload- Returns:
- The current instance
- Since:
- 1.1
-
print
- Parameters:
content
-- Returns:
- Since:
- 1.1
-
println
- Parameters:
content
-- Returns:
- Since:
- 1.1
-