ISISComputingGroup / ISISComputingGroup/IBEX

GUI genie_python: Create print colour command

Open
#2,283 2 comments 0 reactions 0 assignees View on GitHub
re-requested
Dominant language
No language data
Stars
6
Forks
2
Avg merge
16h 40m
Merged PRs (30d)
2

Description

As a scientists I would like to colour the output from genie_python.

This is possible from by using the colours as per this snippet:

```
class AnsiColors:
FG_BLACK = '\033[30m'
FG_RED = '\033[31m'
FG_GREEN = '\033[32m'
FG_YELLOW = '\033[33m'
FG_BLUE = '\033[34m'
FG_MAGENTA = '\033[35m'
FG_CYAN = '\033[36m'
FG_WHITE = '\033[37m'
BG_BLACK = '\033[40m'
BG_RED = '\033[41m'
BG_GREEN = '\033[42m'
BG_YELLOW = '\033[43m'
BG_BLUE = '\033[44m'
BG_MAGENTA = '\033[45m'
BG_CYAN = '\033[46m'
BG_WHITE = '\033[47m'
END = '\033[0m'

for d in dir(AnsiColors):
if d.startswith("FG"):
print(getattr(AnsiColors, d) + d + AnsiColors.END)
if d.startswith("BG"):
print(getattr(AnsiColors, d) + d + AnsiColors.END)
```

We should create a command which could be called `colour_print(PrintColour.BLUE, "hi")`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.