Wobbly-Website/files/python/new-buntcheck.py

91 lines
2.1 KiB
Python
Raw Permalink Normal View History

2023-07-30 18:32:42 +02:00
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Erzeugt eine Tabelle der Farbsteuercodes für Terminals
"""
import sys
errortxt = " Bitte eine Nummer mit angeben, sonst wird die 38 gewählt"
try:
ext = sys.argv[1]
except:
# sys.exit(sys.argv[0] + errortxt)
ext = 38
###########
# Colordefinitions and initscreen
###########
clear = "'\x1b[2J\x1b[H"
home = "'\x1b[H"
green = "\x1b[38;5;40m"
turcois = "\x1b[38;5;37m"
yellow = "\x1b[38;5;11m"
orange = " \x1b[38;5;208m"
white = "\x1b[38;5;255m"
red = "\x1b[38;5;9m"
greenonblack = "\x1b[38;5;40m\x1b[48;5;16m"
whiteonblack = "\033[0m"
redonblack = "\x1b[38;5;9m\x1b[48;5;16m"
textcolor = green
inputcolor = white
hint = turcois
sumcol = orange
msg = red
param = yellow
c = 0
grenz = 4
print(white + "Linux, BSD, div. Unixe, Apple & Windows ANSII 16 Colors: ")
for zahl in range(0, 16):
print("\x1b[" + str(ext) + ";5;" + str(zahl) + "m", "", end="")
print("\\x1b[" + str(ext) + ";5;" + str(zahl) + "m\t", end="")
c = c + 1
if c == grenz:
c = 0
print(whiteonblack)
print(whiteonblack)
c = 0
grenz = 6
print(white + "Linux, BSD, div. Unixe XTERM 256 Colors:")
for zahl in range(16, 256):
print("\x1b[" + str(ext) + ";5;" + str(zahl) + "m", "", end="")
print("\\x1b[" + str(ext) + ";5;" + str(zahl) + "m\t", end="")
c = c + 1
if c == grenz:
c = 0
print(whiteonblack)
print(whiteonblack)
# backgrounds
ext = "48"
c = 0
grenz = 4
print(white + "Linux, BSD, div. Unixe, Apple & Windows ANSII 16 Backgrounds: ")
for zahl in range(0, 16):
print("\x1b[" + str(ext) + ";5;" + str(zahl) + "m", "", end="")
print("\\x1b[" + str(ext) + ";5;" + str(zahl) + "m\t", end="")
c = c + 1
if c == grenz:
c = 0
print(whiteonblack)
print(whiteonblack)
c = 0
grenz = 6
print(white + "Linux, BSD, div. Unixe XTERM 256 Backgrounds:")
for zahl in range(16, 256):
print("\x1b[" + str(ext) + ";5;" + str(zahl) + "m", "", end="")
print("\\x1b[" + str(ext) + ";5;" + str(zahl) + "m\t", end="")
c = c + 1
if c == grenz:
c = 0
print(whiteonblack)
print(whiteonblack)