sevgi-showcase 0.73.2 → 0.94.0

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.
@@ -0,0 +1,6 @@
1
+ dark:
2
+ "#d1bfa7": "#705f4b"
3
+ "#d4a76f": "#b88a55"
4
+ "#6a3f2b": "#d3a778"
5
+ "#333": "#161616"
6
+ "#f5f5f5": "#e8e2dc"
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ GEAR_STYLE = {
5
+ fill: "#333",
6
+ stroke: "none"
7
+ }.freeze
8
+
9
+ SVG :minimal, width: 100, height: 100, viewBox: "0 0 100 100" do
10
+ rect x: 0, y: 0, width: 100, height: 100, fill: "lightgreen"
11
+
12
+ mask id: "hole",
13
+ maskUnits: "userSpaceOnUse",
14
+ maskContentUnits: "userSpaceOnUse",
15
+ x: 0, y: 0, width: 100, height: 100 do
16
+ rect x: 0, y: 0, width: 100, height: 100, fill: "white"
17
+ circle cx: 50, cy: 50, r: 15, fill: "black"
18
+ end
19
+
20
+ circle cx: 50, cy: 50, r: 30, mask: "url(#hole)", **GEAR_STYLE
21
+
22
+ [0, 45, 90, 135].each do |angle|
23
+ rect x: 45, y: 10, width: 10, height: 80,
24
+ mask: "url(#hole)", transform: "rotate(#{angle} 50 50)",
25
+ **GEAR_STYLE
26
+ end
27
+ end.Save
@@ -0,0 +1,12 @@
1
+ <svg width="100" height="100" viewBox="0 0 100 100">
2
+ <rect x="0" y="0" width="100" height="100" fill="lightgreen"/>
3
+ <mask id="hole" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse" x="0" y="0" width="100" height="100">
4
+ <rect x="0" y="0" width="100" height="100" fill="white"/>
5
+ <circle cx="50" cy="50" r="15" fill="black"/>
6
+ </mask>
7
+ <circle cx="50" cy="50" r="30" mask="url(#hole)" fill="#333" stroke="none"/>
8
+ <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(0 50 50)" fill="#333" stroke="none"/>
9
+ <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(45 50 50)" fill="#333" stroke="none"/>
10
+ <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(90 50 50)" fill="#333" stroke="none"/>
11
+ <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(135 50 50)" fill="#333" stroke="none"/>
12
+ </svg>
@@ -0,0 +1,3 @@
1
+ dark:
2
+ "#333": "#e5c39c"
3
+ lightgreen: "#1f3522"
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ CELL_SIZE = 20
5
+ COLORS = %w[#FF6961 #77DD77 #FFD700].freeze
6
+ COLS = 8
7
+ ROWS = 3
8
+
9
+ SVG :minimal,
10
+ width: COLS * CELL_SIZE,
11
+ height: ROWS * CELL_SIZE,
12
+ viewBox: "0 0 #{COLS * CELL_SIZE} #{ROWS * CELL_SIZE}" do
13
+ css ".cell" => { stroke: "white" }
14
+
15
+ COLS.times do |col|
16
+ ROWS.times do |row|
17
+ rect class: "cell",
18
+ x: col * CELL_SIZE, y: row * CELL_SIZE,
19
+ width: CELL_SIZE, height: CELL_SIZE,
20
+ rx: (CELL_SIZE * 0.1).round,
21
+ fill: COLORS[(col + row) % COLORS.length]
22
+ end
23
+ end
24
+ end.Save
@@ -0,0 +1,33 @@
1
+ <svg width="160" height="60" viewBox="0 0 160 60">
2
+ <style type="text/css">
3
+ <![CDATA[
4
+ .cell {
5
+ stroke: white;
6
+ }
7
+ ]]>
8
+ </style>
9
+ <rect class="cell" x="0" y="0" width="20" height="20" rx="2" fill="#FF6961"/>
10
+ <rect class="cell" x="0" y="20" width="20" height="20" rx="2" fill="#77DD77"/>
11
+ <rect class="cell" x="0" y="40" width="20" height="20" rx="2" fill="#FFD700"/>
12
+ <rect class="cell" x="20" y="0" width="20" height="20" rx="2" fill="#77DD77"/>
13
+ <rect class="cell" x="20" y="20" width="20" height="20" rx="2" fill="#FFD700"/>
14
+ <rect class="cell" x="20" y="40" width="20" height="20" rx="2" fill="#FF6961"/>
15
+ <rect class="cell" x="40" y="0" width="20" height="20" rx="2" fill="#FFD700"/>
16
+ <rect class="cell" x="40" y="20" width="20" height="20" rx="2" fill="#FF6961"/>
17
+ <rect class="cell" x="40" y="40" width="20" height="20" rx="2" fill="#77DD77"/>
18
+ <rect class="cell" x="60" y="0" width="20" height="20" rx="2" fill="#FF6961"/>
19
+ <rect class="cell" x="60" y="20" width="20" height="20" rx="2" fill="#77DD77"/>
20
+ <rect class="cell" x="60" y="40" width="20" height="20" rx="2" fill="#FFD700"/>
21
+ <rect class="cell" x="80" y="0" width="20" height="20" rx="2" fill="#77DD77"/>
22
+ <rect class="cell" x="80" y="20" width="20" height="20" rx="2" fill="#FFD700"/>
23
+ <rect class="cell" x="80" y="40" width="20" height="20" rx="2" fill="#FF6961"/>
24
+ <rect class="cell" x="100" y="0" width="20" height="20" rx="2" fill="#FFD700"/>
25
+ <rect class="cell" x="100" y="20" width="20" height="20" rx="2" fill="#FF6961"/>
26
+ <rect class="cell" x="100" y="40" width="20" height="20" rx="2" fill="#77DD77"/>
27
+ <rect class="cell" x="120" y="0" width="20" height="20" rx="2" fill="#FF6961"/>
28
+ <rect class="cell" x="120" y="20" width="20" height="20" rx="2" fill="#77DD77"/>
29
+ <rect class="cell" x="120" y="40" width="20" height="20" rx="2" fill="#FFD700"/>
30
+ <rect class="cell" x="140" y="0" width="20" height="20" rx="2" fill="#77DD77"/>
31
+ <rect class="cell" x="140" y="20" width="20" height="20" rx="2" fill="#FFD700"/>
32
+ <rect class="cell" x="140" y="40" width="20" height="20" rx="2" fill="#FF6961"/>
33
+ </svg>
@@ -0,0 +1,4 @@
1
+ dark:
2
+ "#FF6961": "#f27b72"
3
+ "#77DD77": "#7fdc9c"
4
+ "#FFD700": "#f1c95b"
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ HEART_PATH = "M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z"
5
+
6
+ SVG :minimal, width: 120, height: 120, viewBox: "-10 -10 120 120" do
7
+ mask id: "heart",
8
+ maskUnits: "userSpaceOnUse",
9
+ maskContentUnits: "userSpaceOnUse",
10
+ x: 0, y: 0, width: 100, height: 100 do
11
+ rect x: 0, y: 0, width: 100, height: 100, fill: "white"
12
+ path d: HEART_PATH, fill: "black"
13
+ end
14
+
15
+ polygon points: %w[-10,120 120,120 120,-10], fill: "orange"
16
+ circle cx: 50, cy: 50, r: 50, mask: "url(#heart)", fill: "red"
17
+ end.Save
@@ -0,0 +1,8 @@
1
+ <svg width="120" height="120" viewBox="-10 -10 120 120">
2
+ <mask id="heart" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse" x="0" y="0" width="100" height="100">
3
+ <rect x="0" y="0" width="100" height="100" fill="white"/>
4
+ <path d="M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z" fill="black"/>
5
+ </mask>
6
+ <polygon points="-10,120 120,120 120,-10" fill="orange"/>
7
+ <circle cx="50" cy="50" r="50" mask="url(#heart)" fill="red"/>
8
+ </svg>
@@ -0,0 +1,3 @@
1
+ dark:
2
+ orange: "#f2b35d"
3
+ red: "#e8505b"
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ LED_COUNT = 10
5
+ LED_GAP = 2
6
+ LED_WIDTH = 10
7
+ TOTAL_WIDTH = (LED_COUNT * (LED_WIDTH + LED_GAP)) + 8
8
+
9
+ SVG :minimal, width: TOTAL_WIDTH, height: 30, viewBox: "0 0 #{TOTAL_WIDTH} 30" do
10
+ rect x: 2, y: 2, width: TOTAL_WIDTH - 4, height: 26,
11
+ rx: 4, fill: "none", stroke: "#666"
12
+
13
+ x = 5
14
+ LED_COUNT.times do |i|
15
+ rect x:, y: 5, width: LED_WIDTH, height: 20,
16
+ rx: 3, fill: "green", "fill-opacity": (i < 7 ? 1 : 0.3)
17
+
18
+ x += LED_WIDTH + LED_GAP
19
+ end
20
+ end.Save
@@ -0,0 +1,13 @@
1
+ <svg width="128" height="30" viewBox="0 0 128 30">
2
+ <rect x="2" y="2" width="124" height="26" rx="4" fill="none" stroke="#666"/>
3
+ <rect x="5" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="1"/>
4
+ <rect x="17" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="1"/>
5
+ <rect x="29" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="1"/>
6
+ <rect x="41" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="1"/>
7
+ <rect x="53" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="1"/>
8
+ <rect x="65" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="1"/>
9
+ <rect x="77" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="1"/>
10
+ <rect x="89" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="0.3"/>
11
+ <rect x="101" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="0.3"/>
12
+ <rect x="113" y="5" width="10" height="20" rx="3" fill="green" fill-opacity="0.3"/>
13
+ </svg>
@@ -0,0 +1,3 @@
1
+ dark:
2
+ "#666": "#d8d8d8"
3
+ green: "#7bd88f"
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ SVG width: 100, height: 100 do
5
+ rect x: 0, y: 0, width: 100, height: 100, fill: "white"
6
+ circle cx: 50, cy: 50, r: 40, fill: "purple"
7
+ rect x: 10, y: 50, width: 80, height: 50, fill: "purple"
8
+
9
+ [ 25, 50 ].each do |x|
10
+ circle cx: x, cy: 40, r: 8, fill: "white"
11
+ end
12
+
13
+ path fill: "white", d: %w[
14
+ M11 100 l13 -15 l13 15 l13 -15
15
+ l13 15 l13 -15 l13 15 Z
16
+ ]
17
+ end.Save
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
3
+ <rect x="0" y="0" width="100" height="100" fill="white"/>
4
+ <circle cx="50" cy="50" r="40" fill="purple"/>
5
+ <rect x="10" y="50" width="80" height="50" fill="purple"/>
6
+ <circle cx="25" cy="40" r="8" fill="white"/>
7
+ <circle cx="50" cy="40" r="8" fill="white"/>
8
+ <path fill="white" d="M11 100 l13 -15 l13 15 l13 -15 l13 15 l13 -15 l13 15 Z"/>
9
+ </svg>
@@ -0,0 +1,3 @@
1
+ dark:
2
+ purple: "#e5c39c"
3
+ white: "#222222"
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ SVG :minimal, width: 200, height: 100 do
5
+ rect id: "frame", width: 200, height: 100, rx: 5, fill: "white"
6
+
7
+ circle id: "head", cx: 80, cy: 50, r: 40, fill: "purple"
8
+ circle id: "eye", cx: 90, cy: 28, r: 6, fill: "white"
9
+ polygon id: "mouth", points: %w[ 80,50 120,20 120,80 ], fill: "white"
10
+
11
+ symbol id: "dot" do
12
+ circle cx: 120, cy: 50, r: 6, fill: "purple"
13
+ end
14
+ g id: "dots" do
15
+ TileX "dot", n: 3, d: 18
16
+ end
17
+ end.Save
@@ -0,0 +1,14 @@
1
+ <svg width="200" height="100">
2
+ <rect id="frame" width="200" height="100" rx="5" fill="white"/>
3
+ <circle id="head" cx="80" cy="50" r="40" fill="purple"/>
4
+ <circle id="eye" cx="90" cy="28" r="6" fill="white"/>
5
+ <polygon id="mouth" points="80,50 120,20 120,80" fill="white"/>
6
+ <symbol id="dot">
7
+ <circle cx="120" cy="50" r="6" fill="purple"/>
8
+ </symbol>
9
+ <g id="dots">
10
+ <use id="dot-1" href="#dot" class="tile-col-1 tile-col-first"/>
11
+ <use id="dot-2" href="#dot" class="tile-col-2" x="18"/>
12
+ <use id="dot-3" href="#dot" class="tile-col-3 tile-col-last" x="36"/>
13
+ </g>
14
+ </svg>
@@ -0,0 +1,3 @@
1
+ dark:
2
+ purple: "#e5c39c"
3
+ white: "#222222"
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ # 15 cm width (ruler's length)
5
+ WIDTH = 150
6
+ # 2 cm height
7
+ HEIGHT = 20
8
+
9
+ STYLE = {
10
+ ".labels": {fill: "black", font: "3pt monospace"},
11
+ ".majors": {stroke: "black", "stroke-width": 0.2},
12
+ ".halves": {stroke: "black", "stroke-width": 0.1},
13
+ ".minors": {stroke: "black", "stroke-width": 0.1},
14
+ ".frame": {stroke: "black", "stroke-width": 0.1, fill: "none"}
15
+ }.freeze
16
+
17
+ SVG(width: "210mm", height: "50mm", viewBox: "0 0 210 50") do
18
+ css(STYLE)
19
+
20
+ rect(id: "frame", width: WIDTH, height: HEIGHT, class: "frame")
21
+
22
+ layer(id: "minors") do
23
+ length = 2
24
+
25
+ (0..WIDTH).step(1) do |x|
26
+ VLineBy(x:, y: 0, length: length, class: "minors")
27
+ VLineBy(x:, y: HEIGHT, length: -length, class: "minors")
28
+ end
29
+ end
30
+
31
+ layer(id: "halves") do
32
+ length = 4
33
+
34
+ (0..WIDTH).step(5) do |x|
35
+ VLineBy(x:, y: 0, length: length, class: "halves")
36
+ VLineBy(x:, y: HEIGHT, length: -length, class: "halves")
37
+ end
38
+ end
39
+
40
+ layer(id: "majors") do
41
+ length = 6
42
+
43
+ (10..(WIDTH - 10)).step(10) do |x|
44
+ VLineBy(x:, y: 0, length: length, class: "majors")
45
+ VLineBy(x:, y: HEIGHT, length: -length, class: "majors")
46
+ end
47
+
48
+ layer(id: "labels") do
49
+ (10..(WIDTH - 10)).step(10).each_with_index do |x, i|
50
+ text((i + 1).to_s, "text-anchor": "middle", x:, y: length + 5.5, class: "labels")
51
+ end
52
+ end
53
+ end
54
+ end
55
+ .Save()