breeze_icons 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +6 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +165 -0
- data/README.md +75 -0
- data/Rakefile +196 -0
- data/lib/breeze_icons/data.rb +19920 -0
- data/lib/breeze_icons/version.rb +5 -0
- data/lib/breeze_icons.rb +47 -0
- metadata +54 -0
data/lib/breeze_icons.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "breeze_icons/version"
|
4
|
+
require_relative "breeze_icons/data"
|
5
|
+
|
6
|
+
module BreezeIcons
|
7
|
+
class Error < StandardError; end
|
8
|
+
class NoSuchIcon < Error; end
|
9
|
+
|
10
|
+
class Icon
|
11
|
+
attr_reader :name
|
12
|
+
|
13
|
+
def initialize(name, size: 16)
|
14
|
+
aliased_name = Data::ICONS.dig(:aliases, size.to_s, name)
|
15
|
+
@name = aliased_name || name
|
16
|
+
@icon = Data::ICONS.dig(:icons, size.to_s, @name)
|
17
|
+
@size = size
|
18
|
+
|
19
|
+
unless @icon
|
20
|
+
error_message = ["did not find icon ", name.inspect, aliased_name ? " (aliased to #{aliased_name.inspect})" : nil, ", size #{size.inspect}"].compact.join
|
21
|
+
raise NoSuchIcon, error_message
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_svg(size: @size) = "<svg #{attributes svg_params(size:)}>#{path}</svg>"
|
26
|
+
|
27
|
+
def path = "<path #{attributes path_params}></path>"
|
28
|
+
|
29
|
+
def svg_params(size:) = {
|
30
|
+
class: "breeze-icon breeze-icon-#@name",
|
31
|
+
version: "1.1",
|
32
|
+
viewBox: @icon[:view_box] || "0 0 #@size #@size",
|
33
|
+
width: size,
|
34
|
+
height: size,
|
35
|
+
"aria-hidden": true,
|
36
|
+
}.compact
|
37
|
+
|
38
|
+
def path_params = {
|
39
|
+
d: @icon[:path],
|
40
|
+
transform: @icon[:transform],
|
41
|
+
}.compact
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def attributes(hash) = hash.map { "#{_1}=#{_2.to_s.inspect}" }.join(" ")
|
46
|
+
end
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: breeze_icons
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Georg Gadinger
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A subset of the KDE Plasma Breeze icon set packaged as a gem
|
14
|
+
email:
|
15
|
+
- nilsding@nilsding.org
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- CHANGELOG.md
|
21
|
+
- CODE_OF_CONDUCT.md
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/breeze_icons.rb
|
27
|
+
- lib/breeze_icons/data.rb
|
28
|
+
- lib/breeze_icons/version.rb
|
29
|
+
homepage: https://github.com/nilsding/breeze-icons-ruby
|
30
|
+
licenses:
|
31
|
+
- LGPL-3.0-only
|
32
|
+
metadata:
|
33
|
+
homepage_uri: https://github.com/nilsding/breeze-icons-ruby
|
34
|
+
source_code_uri: https://github.com/nilsding/breeze-icons-ruby
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.0.0
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubygems_version: 3.4.10
|
51
|
+
signing_key:
|
52
|
+
specification_version: 4
|
53
|
+
summary: A subset of the KDE Plasma Breeze icon set packaged as a gem
|
54
|
+
test_files: []
|