Skip to content

Commit

Permalink
faster reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Nov 10, 2023
1 parent f6d0a61 commit 06b50d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion coloraide/algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,7 @@ def transpose(array: ArrayLike | float) -> Array | float:
we don't have a need for that, nor the desire to figure it out :).
"""

s = tuple(reversed(shape(array)))
s = shape(array)[::-1]
if not s:
return array # type: ignore[return-value]

Expand Down
10 changes: 5 additions & 5 deletions docs/src/py/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,21 +696,21 @@ def _color_command_formatter(src="", language="", class_name=None, options=None,
freq = 16
offset = 24

primary = list(reversed(colors[::freq]))
secondary = list(reversed(colors[offset::freq] + [colors[offset // 3]]))
tertiary = list(reversed(colors[::offset // 6]))
primary = colors[::freq][::-1]
secondary = colors[offset::freq] + [colors[offset // 3]][::-1]
tertiary = colors[::offset // 6][::-1]
color_rings = [primary, secondary, tertiary]

extra_rings_start = ''
extra_rings_end = ''
if l > 12:
extra_rings_start = '<div class="tertiary2">'
extra_rings_end += '</div>'
color_rings.append(list(reversed(colors[::offset // 12])))
color_rings.append(colors[::offset // 12][::-1])
if l > 24:
extra_rings_start = '<div class="tertiary3">' + extra_rings_start
extra_rings_end += '</div>'
color_rings.append(list(reversed(colors)))
color_rings.append(colors[::-1])

color_stops = ''
for i, colors in enumerate(color_rings, 1):
Expand Down
4 changes: 2 additions & 2 deletions tools/slice_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def plot_slice(

if hue_index == -1:
# Combine the min/max values in one shape
edge_x.extend(reversed(temp))
edge_x.extend(temp[::-1])
# Close shape
edge_x.append(edge_x[0])

Expand All @@ -271,7 +271,7 @@ def plot_slice(
edge_y.append((edges[0], p1))
temp.append((edges[1], p1))

edge_y.extend(reversed(temp))
edge_y.extend(temp[::-1])
edge_y.append(edge_y[0])

# Get the intersection of X and Y to get the most accurate border
Expand Down

0 comments on commit 06b50d0

Please sign in to comment.