Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- import random
- class color():
- def __init__(self, **args):
- self.__dict__.update(args)
- def update(self, arg):
- for i in arg.keys():
- if i in self.__dict__.keys():
- break;
- return self.__dict__.update(arg)
- def __len__(self):
- return len(self.__dict__)
- def __str__(self):
- color = ''
- for i in self.__dict__.keys():
- color += self.__dict__[i] + i + '\033[0m' + '\n'
- return color
- def __getattr__(self, color):
- try:
- return self.__dict__[color]
- except Exception as e:
- return e, 'Color not found'
- def list(self):
- l = []
- for i in self.__dict__.keys():
- l.append(i)
- return l
- def generate_color_list():
- pass
- def main():
- colors = {
- 'black' : '\033[95m',
- 'write' : '\033[94m',
- 'green' : '\033[42m'
- }
- c = color(**colors)
- print c
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement