16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/boring_avatars/variants/sunset.rb', line 16
def render(input:, hash:, ids:)
colors = Array.new(ELEMENTS) { |index| Utilities.random_color(hash + index, input.colors) }
content = [
element(
"path",
{ "fill" => "url(##{ids[:gradient_0]})", "d" => "M0 0h80v40H0z" }
),
element(
"path",
{ "fill" => "url(##{ids[:gradient_1]})", "d" => "M0 40h80v40H0z" }
)
]
defs = [
gradient(ids[:gradient_0], 0, SIZE / 2, colors[0], colors[1]),
gradient(ids[:gradient_1], SIZE / 2, SIZE, colors[2], colors[3])
]
VariantResult.new(size: SIZE, content: content, defs: defs)
end
|