mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
scripts: generate-alt-random-writes: add support for bold/italic/underline
This commit is contained in:
parent
60c8637231
commit
b437013a3b
1 changed files with 10 additions and 0 deletions
|
|
@ -27,6 +27,9 @@ def main():
|
||||||
parser.add_argument('--colors-rgb', action='store_true')
|
parser.add_argument('--colors-rgb', action='store_true')
|
||||||
parser.add_argument('--scroll', action='store_true')
|
parser.add_argument('--scroll', action='store_true')
|
||||||
parser.add_argument('--scroll-region', action='store_true')
|
parser.add_argument('--scroll-region', action='store_true')
|
||||||
|
parser.add_argument('--attr-bold', action='store_true')
|
||||||
|
parser.add_argument('--attr-italic', action='store_true')
|
||||||
|
parser.add_argument('--attr-underline', action='store_true')
|
||||||
|
|
||||||
opts = parser.parse_args()
|
opts = parser.parse_args()
|
||||||
out = opts.out if opts.out is not None else sys.stdout
|
out = opts.out if opts.out is not None else sys.stdout
|
||||||
|
|
@ -121,6 +124,13 @@ def main():
|
||||||
# New-style (sub-parameter based)
|
# New-style (sub-parameter based)
|
||||||
out.write(f'\033[{base}:2::{rgb[0]}:{rgb[1]}:{rgb[2]}m')
|
out.write(f'\033[{base}:2::{rgb[0]}:{rgb[1]}:{rgb[2]}m')
|
||||||
|
|
||||||
|
if opts.attr_bold and rand.read(1)[0] % 5 == 0:
|
||||||
|
out.write('\033[1m')
|
||||||
|
if opts.attr_italic and rand.read(1)[0] % 5 == 0:
|
||||||
|
out.write('\033[3m')
|
||||||
|
if opts.attr_underline and rand.read(1)[0] % 5 == 0:
|
||||||
|
out.write('\033[4m')
|
||||||
|
|
||||||
out.write(c * repeat)
|
out.write(c * repeat)
|
||||||
|
|
||||||
do_sgr_reset = rand.read(1)[0] % 2
|
do_sgr_reset = rand.read(1)[0] % 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue