barbershop 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 04dfa931a2cf7ed29b4b6660d8e201a902fcdebe5927f700737a12bc2a8a6906
4
+ data.tar.gz: aa55a1e1e2e240a1e6bc500929fbeb9ce77b93d2a6b89e4cc5e765ae1ad55390
5
+ SHA512:
6
+ metadata.gz: aad854331a700ff8f93922bfbe0cee1fd14bf361dadcef52c48d071dec011fd192c25d86266d7e465169ca95b0163851a141df0b6e69fa104f3e844f1d33fed4
7
+ data.tar.gz: 3c8fb11e9510285b458603fac4e3ce2ae61606147d099b79b07f02cfceef9dd62e1d99ebf0882cc83be1628eeaacc876c76c23d7bc6a283df42b44fa4be99c86
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 0.0.1 / 2023-08-26
2
+
3
+ * Everything is new. First release
data/Manifest.txt ADDED
@@ -0,0 +1,8 @@
1
+ CHANGELOG.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ config/spritesheet-hair.csv
6
+ config/spritesheet-hair.png
7
+ lib/barbershop.rb
8
+ lib/barbershop/version.rb
data/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # barbershop
2
+
3
+ barberhsop gem - make your own (pixel) punk hair style incl. mohawk, wild & crazy, short & long, and much more with your own hair colors incl white, silver, blonde, pink, purple, red and much more
4
+
5
+
6
+
7
+ * home :: [github.com/cryptopunksnotdead/punkart.sandbox](https://github.com/cryptopunksnotdead/punkart.sandbox)
8
+ * bugs :: [github.com/cryptopunksnotdead/punkart.sandbox/issues](https://github.com/cryptopunksnotdead/punkart.sandbox/issues)
9
+ * gem :: [rubygems.org/gems/barbershop](https://rubygems.org/gems/barbershop)
10
+ * rdoc :: [rubydoc.info/gems/barbershop](http://rubydoc.info/gems/barbershop)
11
+
12
+
13
+
14
+ ## Usage
15
+
16
+
17
+ ### Hair Colors
18
+
19
+ For now the hair colors include:
20
+
21
+ - ![](i/color-black.png) black - #000000 / rgb( 0 0 0) - hsl( 0° 0% 0%) - hsv( 0° 0% 0%)
22
+ - ![](i/color-brown.png) brown - #51360c / rgb( 81 54 12) - hsl( 37° 74% 18%) - hsv( 37° 85% 32%)
23
+ - ![](i/color-brunette.png) brunette - #a66e2c / rgb(166 110 44) - hsl( 32° 58% 41%) - hsv( 32° 73% 65%)
24
+ - ![](i/color-orange.png) orange - #e65700 / rgb(230 87 0) - hsl( 23° 100% 45%) - hsv( 23° 100% 90%)
25
+ - ![](i/color-red.png) red - #e22626 / rgb(226 38 38) - hsl( 0° 76% 52%) - hsv( 0° 83% 89%)
26
+ - ![](i/color-pink.png) pink - #ff8ebe / rgb(255 142 190) - hsl(335° 100% 78%) - hsv(335° 44% 100%)
27
+ - ![](i/color-purple.png) purple - #710cc7 / rgb(113 12 199) - hsl(272° 89% 41%) - hsv(272° 94% 78%)
28
+ - ![](i/color-green.png) green - #28b143 / rgb( 40 177 67) - hsl(132° 63% 43%) - hsv(132° 77% 69%)
29
+ - ![](i/color-blonde.png) blonde - #fff68e / rgb(255 246 142) - hsl( 55° 100% 78%) - hsv( 55° 44% 100%)
30
+ - ![](i/color-silver.png) silver - #e0e0e0 / rgb(224 224 224) - hsl( 0° 0% 88%) - hsv( 0° 0% 88%)
31
+ - ![](i/color-white.png) white - #ffffff / rgb(255 255 255) - hsl( 0° 0% 100%) - hsv( 0° 0% 100%)
32
+
33
+
34
+
35
+ ### Hair Styles
36
+
37
+ The hair styles include:
38
+
39
+ - afro ![](i/hair/afro-strip.png)
40
+ - big ![](i/hair/big-strip.png)
41
+ - bob ![](i/hair/bob-strip.png)
42
+ - bob2 ![](i/hair/bob2-strip.png)
43
+ - buzzcut ![](i/hair/buzzcut-strip.png)
44
+ - clown ![](i/hair/clown-strip.png)
45
+ - comma ![](i/hair/comma-strip.png)
46
+ - crazy ![](i/hair/crazy-strip.png)
47
+ - crazy2 ![](i/hair/crazy2-strip.png)
48
+ - crazy3 ![](i/hair/crazy3-strip.png)
49
+ - fringeup ![](i/hair/fringeup-strip.png)
50
+ - frumpy ![](i/hair/frumpy-strip.png)
51
+ - halfshaved ![](i/hair/halfshaved-strip.png)
52
+ - halfshaved2 ![](i/hair/halfshaved2-strip.png)
53
+ - long ![](i/hair/long-strip.png)
54
+ - longfrontcurly ![](i/hair/longfrontcurly-strip.png)
55
+ - messier ![](i/hair/messier-strip.png)
56
+ - messy ![](i/hair/messy-strip.png)
57
+ - mohawk ![](i/hair/mohawk-strip.png)
58
+ - mohawk2 ![](i/hair/mohawk2-strip.png)
59
+ - mohawkbig ![](i/hair/mohawkbig-strip.png)
60
+ - mohawkshort ![](i/hair/mohawkshort-strip.png)
61
+ - mohawkthin ![](i/hair/mohawkthin-strip.png)
62
+ - oldman ![](i/hair/oldman-strip.png)
63
+ - peakspike ![](i/hair/peakspike-strip.png)
64
+ - pigtails ![](i/hair/pigtails-strip.png)
65
+ - pompadour ![](i/hair/pompadour-strip.png)
66
+ - short ![](i/hair/short-strip.png)
67
+ - short2 ![](i/hair/short2-strip.png)
68
+ - short3 ![](i/hair/short3-strip.png)
69
+ - shortmessy ![](i/hair/shortmessy-strip.png)
70
+ - side ![](i/hair/side-strip.png)
71
+ - side2 ![](i/hair/side2-strip.png)
72
+ - straight ![](i/hair/straight-strip.png)
73
+ - stringy ![](i/hair/stringy-strip.png)
74
+ - vampire ![](i/hair/vampire-strip.png)
75
+ - vampire2 ![](i/hair/vampire2-strip.png)
76
+ - wild ![](i/hair/wild-strip.png)
77
+ - wild2 ![](i/hair/wild2-strip.png)
78
+ - wild3 ![](i/hair/wild3-strip.png)
79
+ - wild4 ![](i/hair/wild4-strip.png)
80
+ - wild5 ![](i/hair/wild5-strip.png)
81
+
82
+ plus (no color - alpha channel only)
83
+
84
+ - shavedhead ![](i/hair/shavedhead.png)
85
+
86
+
87
+
88
+ ### How To Make Hair Styles
89
+
90
+
91
+ Use the make method - pass in the hair style and optional the color (default is black) -
92
+ and get the hair (pixel art) image attribute (in 24x24px).
93
+
94
+ ``` ruby
95
+ require 'barbershop'
96
+
97
+ hair = Barbershop::Hair.make( 'Buzz Cut' )
98
+ hair.save( "./buzzcut-black.png" )
99
+ hair.zoom(4).save( "./buzzcut-black@4x.png" )
100
+
101
+ hair = Barbershop::Hair.make( 'Mohawk Big', color: 'Green' )
102
+ hair.save( "./mohawkbig-green.png" )
103
+ hair.zoom(4).save( "./mohawkbig-green@4x.png" )
104
+ ```
105
+
106
+
107
+ resulting in:
108
+
109
+ ![](i/buzzcut-black.png)
110
+ ![](i/mohawkbig-green.png)
111
+
112
+ 4x
113
+
114
+ ![](i/buzzcut-black@4x.png)
115
+ ![](i/mohawkbig-green@4x.png)
116
+
117
+
118
+ That's it for now.
119
+
120
+
121
+
122
+
123
+ ## Questions? Comments?
124
+
125
+ Join us in the [Punk Art discord (chat server)](https://discord.gg/FE3HeXNKRa). Yes you can.
126
+ Your questions and commentary welcome.
127
+
128
+ Or post them over at the [Help & Support](https://github.com/geraldb/help) page. Thanks.
129
+
130
+
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ require 'hoe'
2
+ require './lib/barbershop/version.rb'
3
+
4
+
5
+ ###
6
+ # hack/ quick fix for broken intuit_values - overwrite with dummy
7
+ # class Hoe
8
+ # def intuit_values( input ); end
9
+ # end
10
+
11
+
12
+ Hoe.spec 'barbershop' do
13
+
14
+ self.version = Pixelart::Module::Barbershop::VERSION
15
+
16
+ self.summary = 'barberhsop gem - make your own (pixel) punk hair style incl. mohawk, wild & crazy, short & long, and much more with your own hair colors incl white, silver, blonde, pink, purple, red and much more'
17
+ self.description = summary
18
+
19
+ self.urls = { home: 'https://github.com/cryptopunksnotdead/punkart.sandbox' }
20
+
21
+ self.author = 'Gerald Bauer'
22
+ self.email = 'gerald.bauer@gmail.com'
23
+
24
+ # switch extension to .markdown for gihub formatting
25
+ self.readme_file = 'README.md'
26
+ self.history_file = 'CHANGELOG.md'
27
+
28
+ self.extra_deps = [
29
+ ['pixelart'],
30
+ ['spritesheet'],
31
+ ]
32
+
33
+ self.licenses = ['Public Domain']
34
+
35
+ self.spec_extras = {
36
+ required_ruby_version: '>= 2.3'
37
+ }
38
+
39
+ end
40
+
@@ -0,0 +1,44 @@
1
+ id, category, name, more_names
2
+ 0, , afro,
3
+ 1, , big,
4
+ 2, , bob,
5
+ 3, , bob2,
6
+ 4, , buzzcut,
7
+ 5, , clown,
8
+ 6, , comma,
9
+ 7, , crazy,
10
+ 8, , crazy2,
11
+ 9, , crazy3,
12
+ 10, , fringeup,
13
+ 11, , frumpy,
14
+ 12, , halfshaved,
15
+ 13, , halfshaved2,
16
+ 14, , long,
17
+ 15, , longfrontcurly,
18
+ 16, , messier,
19
+ 17, , messy,
20
+ 18, , mohawk,
21
+ 19, , mohawk2,
22
+ 20, , mohawkbig,
23
+ 21, , mohawkshort,
24
+ 22, , mohawkthin,
25
+ 23, , oldman,
26
+ 24, , peakspike,
27
+ 25, , pigtails,
28
+ 26, , pompadour,
29
+ 27, , shavedhead,
30
+ 28, , short,
31
+ 29, , short2,
32
+ 30, , short3,
33
+ 31, , shortmessy,
34
+ 32, , side,
35
+ 33, , side2,
36
+ 34, , straight,
37
+ 35, , stringy,
38
+ 36, , vampire,
39
+ 37, , vampire2,
40
+ 38, , wild,
41
+ 39, , wild2,
42
+ 40, , wild3,
43
+ 41, , wild4,
44
+ 42, , wild5,
Binary file
@@ -0,0 +1,24 @@
1
+ module Pixelart
2
+ module Module
3
+ module Barbershop
4
+ MAJOR = 0
5
+ MINOR = 0
6
+ PATCH = 1
7
+ VERSION = [MAJOR,MINOR,PATCH].join('.')
8
+
9
+ def self.version
10
+ VERSION
11
+ end
12
+
13
+ def self.banner
14
+ "barbershop/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
15
+ end
16
+
17
+ def self.root
18
+ File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
19
+ end
20
+
21
+ end # module Barbershop
22
+ end # module Module
23
+ end # module Pixelart
24
+
data/lib/barbershop.rb ADDED
@@ -0,0 +1,123 @@
1
+ require 'pixelart'
2
+ require 'spritesheet'
3
+
4
+
5
+ # our code
6
+ require_relative 'barbershop/version' # let version go first
7
+
8
+
9
+
10
+ module Barbershop
11
+ module Hair
12
+ def self.sheet
13
+ @sheet ||= Pixelart::Spritesheet.read(
14
+ "#{Pixelart::Module::Barbershop.root}/config/spritesheet-hair.png",
15
+ "#{Pixelart::Module::Barbershop.root}/config/spritesheet-hair.csv",
16
+ width: 24,
17
+ height: 24 )
18
+ end
19
+ def self.find_by( name: ) sheet.find_by( name: name ); end
20
+
21
+ def self.colors
22
+ @colors ||= begin
23
+ {
24
+ 'black' => '000000',
25
+
26
+ 'brown' => '51360c', # (darker) brown
27
+ 'brunette' => 'a66e2c', # lighter brown
28
+
29
+ 'orange' => 'e65700',
30
+ 'red' => 'e22626',
31
+ 'pink' => 'ff8ebe',
32
+ 'purple' => '710cc7',
33
+
34
+ 'green' => '28b143',
35
+
36
+ 'blonde' => 'fff68e',
37
+ 'silver' => 'e0e0e0',
38
+ 'white' => 'FFFFFF',
39
+ }.reduce( {} ) do |h, (name, color_hex)|
40
+ h[ name ] = Color.from_hex( color_hex )
41
+ h
42
+ end
43
+ end
44
+ @colors
45
+ end
46
+
47
+ def self.colorize( hair, color: )
48
+ h,s,v = Color.to_hsv( color, include_alpha: false )
49
+ h = h % 360 ## make sure h(ue) is always positive!!!
50
+ puts " #{[h,s,v].inspect}"
51
+
52
+ # lighter - #2a2aff / rgb( 42 42 255) - hsl(240° 100% 58%) - hsv(240° 84% 100%)
53
+ # - used in hair( frumpy, f/pigtails3, f/straight3, f/wild4, f/wild5 )
54
+
55
+ # lightest - #5454ff / rgb( 84 84 255) - hsl(240° 100% 66%) - hsv(240° 67% 100%)
56
+ # - used in hair(mohawk thin)
57
+
58
+ # darker - #0000dd / rgb( 0 0 221) - hsl(240° 100% 43%) - hsv(240° 100% 87%)
59
+ # - used in hair(mohawk)
60
+
61
+ ## todo/fix: make lighter/darker formula more "robust"/ better!!!
62
+ if color == 0x000000ff # black
63
+ # hsv( 0° 0% 0%)
64
+ lighter = Color.from_hsv( h, 0.0, 0.16 )
65
+ lightest = Color.from_hsv( h, 0.0, 0.33 )
66
+ darker = Color.from_hsv( h, 0.0, 0.0 ) ## darker than black not possible ;-)
67
+ elsif color == 0xe0e0e0ff # silver
68
+ # hsv( 0° 0% 88%)
69
+ lighter = Color.from_hsv( h, 0.0, 1.0 ) # white
70
+ lightest = Color.from_hsv( h, 0.0, 1.0 ) # white
71
+ darker = Color.from_hsv( h, 0.0, [0.0, v-0.13].max )
72
+ elsif color == 0xffffffff # white
73
+ # hsv( 0° 0% 100%)
74
+ lighter = Color.from_hsv( h, 0.0, [0.0, v-0.11].max ) # note: make darker
75
+ lightest = Color.from_hsv( h, 0.0, 1.0 )
76
+ darker = Color.from_hsv( h, 0.0, [0.0, v-0.16].max )
77
+ else
78
+ lighter = Color.from_hsv( h, [0.0, s-0.16].max, v )
79
+ lightest = Color.from_hsv( h, [0.0, s-0.33].max, v )
80
+ darker = Color.from_hsv( h, s, [0.0, v-0.13].max )
81
+ end
82
+
83
+ hair.change_colors( {
84
+ '0000ffff' => color,
85
+ '2a2affff' => lighter,
86
+ '5454ffff' => lightest,
87
+ '0000ddff' => darker,
88
+ })
89
+ end # method self.colorize
90
+
91
+
92
+ def self.make( style, color: 'black' )
93
+ ## pass-through shavedhead (no colors - alpha only) - why? why not?
94
+ hair = sheet.find_by( name: style )
95
+ if hair.nil?
96
+ puts "!! ERROR - unknow hair style >#{style}<; sorry"
97
+ exit 1
98
+ end
99
+
100
+ color_key = color.downcase.gsub(' ','')
101
+ rgba = colors[ color_key ]
102
+ if rgba.nil?
103
+ puts "!! ERROR - unknow hair color >#{style}<; sorry"
104
+ exit 1
105
+ end
106
+
107
+ colorize( hair, color: rgba )
108
+ end
109
+
110
+
111
+ end # module Hair
112
+ end # module Barbershop
113
+
114
+
115
+
116
+ ## add aliases - why? why not?
117
+ Barbers = Barbershop
118
+ Barber = Barbershop
119
+ BarberShop = Barbershop
120
+
121
+
122
+
123
+ puts Pixelart::Module::Barbershop.banner ## say hello
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: barbershop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gerald Bauer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-08-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pixelart
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: spritesheet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '7'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '4.0'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '7'
61
+ - !ruby/object:Gem::Dependency
62
+ name: hoe
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '4.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '4.0'
75
+ description: barberhsop gem - make your own (pixel) punk hair style incl. mohawk,
76
+ wild & crazy, short & long, and much more with your own hair colors incl white,
77
+ silver, blonde, pink, purple, red and much more
78
+ email: gerald.bauer@gmail.com
79
+ executables: []
80
+ extensions: []
81
+ extra_rdoc_files:
82
+ - CHANGELOG.md
83
+ - Manifest.txt
84
+ - README.md
85
+ files:
86
+ - CHANGELOG.md
87
+ - Manifest.txt
88
+ - README.md
89
+ - Rakefile
90
+ - config/spritesheet-hair.csv
91
+ - config/spritesheet-hair.png
92
+ - lib/barbershop.rb
93
+ - lib/barbershop/version.rb
94
+ homepage: https://github.com/cryptopunksnotdead/punkart.sandbox
95
+ licenses:
96
+ - Public Domain
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options:
100
+ - "--main"
101
+ - README.md
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '2.3'
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubygems_version: 3.4.10
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: barberhsop gem - make your own (pixel) punk hair style incl. mohawk, wild
119
+ & crazy, short & long, and much more with your own hair colors incl white, silver,
120
+ blonde, pink, purple, red and much more
121
+ test_files: []