Skip to content

Commit

Permalink
Merge pull request #3858 from galaxyproject/release-testing-fixes
Browse files Browse the repository at this point in the history
Release testing fixes
  • Loading branch information
hexylena authored Feb 3, 2023
2 parents f113d9f + 13a9bab commit ccfe5c1
Show file tree
Hide file tree
Showing 38 changed files with 477 additions and 302 deletions.
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,19 @@ icon-tag:
docker_image: fab fa-docker
email: far fa-envelope
exchange: fas fa-exchange-alt
switch-histories: fas fa-exchange-alt
event: far fa-calendar
feedback: far fa-comments
galaxy-advanced-search: fas fa-angle-double-down
galaxy-barchart: fas fa-chart-bar
galaxy-bug: fas fa-bug
galaxy-chart-select-data: fas fa-database
galaxy-clear: fas fa-times-circle
galaxy-columns: fas fa-columns
galaxy-cross: fas fa-times
galaxy-delete: fas fa-trash
galaxy-dropdown: fas fa-caret-down
galaxy-history-options: fas fa-caret-down # Replaces gear.
galaxy-eye: far fa-eye
galaxy-gear: fas fa-cog
galaxy-history: fas fa-columns
Expand All @@ -116,6 +120,7 @@ icon-tag:
galaxy-panelview: fas fa-list
galaxy-pencil: fas fa-pencil-alt
galaxy-refresh: fas fa-redo
galaxy-undo: fas fa-undo
galaxy-rulebuilder-history: fas fa-history
galaxy-save: far fa-save
galaxy-scratchbook: fas fa-th
Expand Down
86 changes: 17 additions & 69 deletions _plugins/colour-tags.rb
Original file line number Diff line number Diff line change
@@ -1,91 +1,39 @@
require 'digest'
require './_plugins/gtn/hsluv'

module ColourTag
def self.colour_tag(contents)
d = (Digest::SHA256.hexdigest contents).to_i(16)

hue = ((d >> 4) % 360).abs
saturation = 0.8
lightness = 85
bgColor = "hsl(#{hue}, #{saturation * 100}%, #{lightness}%)"
brColor = "hsl(#{hue}, #{saturation * 100}%, #{lightness - 40}%)"
lightnessOffset = 75
lightness = lightnessOffset + (hash & 0xf)

r, g, b = self.hsl2rgb(hue, saturation, lightness / 100.0)
fgColor = self.contrasting_colour(r, g, b)

return "background-color: #{bgColor}; color: #{fgColor}; border: 1px solid #{brColor}";
end

def self.contrasting_colour(r, g, b)
# Implement W3C contrasting color algorithm
# http://www.w3.org/TR/AERT#color-contrast
# Assumes r, g, b are in the set [0, 1]
o = (r * 255 * 299 + g * 255 * 587 + b * 255 * 114) / 1000;
if o > 125 then
"#333"
else
"#ccc"
end
end

def self.hue2rgb(p, q, t)
if t < 0 then
t = t + 1
end

if t > 1 then
t = t - 1
end

if t < 1/6 then
return p + (q - p) * 6 * t
elsif t < 1/2 then
return q
elsif t < 2/3 then
return p + (q - p) * (2 / 3 - t) * 6
# randomly make yellow tags bright
if hue > 70 and hue < 96 and ((d & 0x100) === 0x100)
lightness += (100 - lightness) * 0.75
end

return p
end

def self.hsl2rgb(h, s, l)
# Converts an HSL color value to RGB. Conversion formula
# adapted from http://en.wikipedia.org/wiki/HSL_color_space.
# Assumes h, s, and l are contained in the set [0, 1] and
# returns r, g, and b in the set [0, 1].
r = 0
g = 0
b = 0

if s == 0 then
r = l
g = l
b = l

return r, g, b
end
primary = Hsluv.hsluv_to_hex(hue, 100, lightness)
darker = Hsluv.hsluv_to_hex(hue, 100, lightness * 0.9)
dimmed = Hsluv.hsluv_to_hex(hue, 100, lightness * 0.95)

if l < 0.5 then
q = l * (1 + s)
else
q = l + s - l * s
end
p = 2 * l - q

r = self.hue2rgb(p, q, h + 1 / 3)
g = self.hue2rgb(p, q, h)
b = self.hue2rgb(p, q, h - 1 / 3)

return r, g, b
return "--color-primary: #{primary}; --color-darker: #{darker}; --color-dimmed: #{dimmed};"
end
end



module Jekyll
module ImplColourTag
def cache
@@cache ||= Jekyll::Cache.new("ColorTags")
end

def colour_tag(contents)
ColourTag.colour_tag(contents)
cache.getset(contents) do
ColourTag.colour_tag(contents)
end
end
end
end
Expand Down
Loading

0 comments on commit ccfe5c1

Please sign in to comment.