itrm 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itrm
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Interactive Terminal Utilities
5
5
  Home-page: https://gitlab.com/davidwoodburn/itrm
6
6
  Author: David Woodburn
@@ -59,7 +59,8 @@ call to `itrm`. The following table lists the configuration options:
59
59
  | `ar` | `0.48` | aspect ratio of characters |
60
60
 
61
61
  There is also a method for changing the color map: `itrm.config.cmap()`. It
62
- takes a string: `"colors"`, `"grays"`, `"reds"`, `"greens"`, or `"blues"`.
62
+ takes a string: `"colors"`, `"viridis"`, `"grays"`, `"reds"`, `"greens"`, or
63
+ `"blues"`.
63
64
 
64
65
  ## Interactive Plots
65
66
 
@@ -44,7 +44,8 @@ call to `itrm`. The following table lists the configuration options:
44
44
  | `ar` | `0.48` | aspect ratio of characters |
45
45
 
46
46
  There is also a method for changing the color map: `itrm.config.cmap()`. It
47
- takes a string: `"colors"`, `"grays"`, `"reds"`, `"greens"`, or `"blues"`.
47
+ takes a string: `"colors"`, `"viridis"`, `"grays"`, `"reds"`, `"greens"`, or
48
+ `"blues"`.
48
49
 
49
50
  ## Interactive Plots
50
51
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = itrm
3
- version = 0.2.0
3
+ version = 0.2.1
4
4
  author = David Woodburn
5
5
  author_email = david.woodburn@icloud.com
6
6
  description = Interactive Terminal Utilities
@@ -37,16 +37,18 @@ import numpy as np
37
37
 
38
38
  # Constants
39
39
  # (blue, green, yellow, orange, magenta, purple)
40
- DARK_COLORS = [33, 40, 220, 202, 201, 93]
41
- LITE_COLORS = [75, 82, 228, 214, 213, 135]
42
- DARK_GRAYS = [253, 250, 247, 244, 241, 238]
43
- LITE_GRAYS = [255, 252, 249, 246, 243, 240]
44
- DARK_REDS = [197, 196, 160, 124, 88, 52]
45
- LITE_REDS = [198, 197, 196, 160, 124, 88]
46
- DARK_GREENS = [47, 46, 40, 34, 28, 22]
47
- LITE_GREENS = [48, 47, 46, 40, 34, 28]
48
- DARK_BLUES = [27, 21, 20, 19, 18, 17]
49
- LITE_BLUES = [33, 27, 21, 20, 19, 18]
40
+ DARK_COLORS = [ 33, 40, 220, 202, 201, 93]
41
+ LITE_COLORS = [ 75, 82, 228, 214, 213, 135]
42
+ DARK_VIRIDIS = [184, 113, 36, 30, 60, 53]
43
+ LITE_VIRIDIS = [227, 156, 79, 73, 103, 96]
44
+ DARK_GRAYS = [253, 250, 247, 244, 241, 238]
45
+ LITE_GRAYS = [255, 252, 249, 246, 243, 240]
46
+ DARK_REDS = [197, 196, 160, 124, 88, 52]
47
+ LITE_REDS = [198, 197, 196, 160, 124, 88]
48
+ DARK_GREENS = [ 47, 46, 40, 34, 28, 22]
49
+ LITE_GREENS = [ 48, 47, 46, 40, 34, 28]
50
+ DARK_BLUES = [ 27, 21, 20, 19, 18, 17]
51
+ LITE_BLUES = [ 33, 27, 21, 20, 19, 18]
50
52
  COLOR_CNT = 6 # number of colors in the color map
51
53
  eps = 1e-32 # minimum magnitude
52
54
 
@@ -58,13 +60,16 @@ class config: # configuration settings
58
60
  ar = 0.48 # aspect ratio of characters
59
61
  darks = DARK_COLORS # dark color map
60
62
  lites = LITE_COLORS # light color map
61
-
63
+
62
64
  def cmap(cmap="colors"):
63
65
  if not isinstance(cmap, str):
64
66
  raise ValueError(f"cmap must be a string: {cmap}")
65
67
  if cmap == "colors":
66
68
  config.darks = DARK_COLORS
67
69
  config.lites = LITE_COLORS
70
+ elif cmap == "viridis":
71
+ config.darks = DARK_VIRIDIS
72
+ config.lites = LITE_VIRIDIS
68
73
  elif cmap == "grays":
69
74
  config.darks = DARK_GRAYS
70
75
  config.lites = LITE_GRAYS
@@ -1880,3 +1885,37 @@ def draw_bar(n, N, colorize, fat):
1880
1885
 
1881
1886
  # Show the cursor.
1882
1887
  print("\x1b[?25h", end="", flush=True)
1888
+
1889
+
1890
+ def viridis_map():
1891
+ """
1892
+ Display the viridis color palette. The original RGB values came from
1893
+ https://waldyrious.net/viridis-palette-generator/.
1894
+ """
1895
+
1896
+ # Input colors.
1897
+ vir = np.array([
1898
+ [253, 231, 37],
1899
+ [122, 209, 81],
1900
+ [34, 168, 132],
1901
+ [42, 120, 142],
1902
+ [65, 68, 135],
1903
+ [68, 1, 84]])
1904
+
1905
+ # Show dark colors.
1906
+ for n in range(6):
1907
+ r = int(5*vir[n, 0]/255)
1908
+ g = int(5*vir[n, 1]/255)
1909
+ b = int(5*vir[n, 2]/255)
1910
+ c = 16 + 36*r + 6*g + b
1911
+ print(f"\x1b[48;5;{c}m {c:03d} \x1b[0m ", end="")
1912
+ print()
1913
+
1914
+ # Show dark colors.
1915
+ for n in range(6):
1916
+ r = int(5*vir[n, 0]/255 + 1)
1917
+ g = int(5*vir[n, 1]/255 + 1)
1918
+ b = int(5*vir[n, 2]/255 + 1)
1919
+ c = 16 + 36*r + 6*g + b
1920
+ print(f"\x1b[48;5;{c}m {c:03d} \x1b[0m ", end="")
1921
+ print()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: itrm
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Interactive Terminal Utilities
5
5
  Home-page: https://gitlab.com/davidwoodburn/itrm
6
6
  Author: David Woodburn
@@ -59,7 +59,8 @@ call to `itrm`. The following table lists the configuration options:
59
59
  | `ar` | `0.48` | aspect ratio of characters |
60
60
 
61
61
  There is also a method for changing the color map: `itrm.config.cmap()`. It
62
- takes a string: `"colors"`, `"grays"`, `"reds"`, `"greens"`, or `"blues"`.
62
+ takes a string: `"colors"`, `"viridis"`, `"grays"`, `"reds"`, `"greens"`, or
63
+ `"blues"`.
63
64
 
64
65
  ## Interactive Plots
65
66
 
File without changes
File without changes
File without changes
File without changes