├── .gitignore ├── .idea ├── vcs.xml └── watcherTasks.xml ├── LICENSE ├── README.md ├── badgerly.css ├── badgerly.scss ├── bower.json ├── gulpfile.js ├── package.json └── src ├── _badge-colors.scss ├── _badge-shape.scss ├── _core.scss ├── _countries.scss ├── _extensions.scss ├── _ribbon-colors.scss └── sizes ├── _huge.scss ├── _large.scss ├── _medium.scss ├── _small.scss └── _tiny.scss /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Sass template 3 | *.css.map 4 | 5 | .gitignore 6 | .idea/ 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/watcherTasks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 23 | 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Steven Hunt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Badgerly 3 | 4 | ``` 5 | > bower install badgerly --save 6 | ``` 7 | 8 | BADGERLY BADGER BADGE 9 | 10 | --- 11 | - Integrates easily with [Font Awesome](http://fontawesome.io/)! 12 | - Fully implemented in CSS 3, no spacer images or other hackery. 13 | - Simple to use CSS classes which can be extended. 14 | - Implemented in SCSS, also available in plain CSS for your convenience. 15 | 16 | ## Check out the [Wall of Badges](https://jsfiddle.net/stevenmhunt/3krm64o1/) 17 | WALL OF BADGES 18 | 19 | ## Integrations 20 | - [angular-badgerly](https://github.com/stevenmhunt/angular-badgerly) - Adds directive support for Badgerly, making it even easier (somehow) to create badges! 21 | 22 | ## Colors 23 | Gold, Silver, Bronze 24 | 25 | ## Sizes 26 | Tiny, Small, Medium, Large, Huge 27 | 28 | ## Ribbon Patterns 29 | Red, Orange, Yellow, Green, Blue, Purple, Pink, Black, Rainbow, and a bunch of country flags! 30 | 31 | Supports either a single ribbon or a lanyard with two visible ribbons. 32 | 33 | ## Examples 34 | 35 | ### [Round silver metal with a single purple ribbon](https://jsfiddle.net/stevenmhunt/wqyrq8a0/) 36 | ```html 37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | ``` 45 | 46 | ### [Diamond gold metal with a red lanyard](https://jsfiddle.net/stevenmhunt/0739du3f/) 47 | ```html 48 |
49 |
50 |
51 |
52 |
53 |
54 | 55 |
56 |
57 | ``` 58 | 59 | ## Contributing 60 | 61 | Contributions and pull requests are welcome! Here are instructions on how to build the project: 62 | 63 | - Make changes in the **badgerly.scss** file. 64 | - Then, run `npm install` followed by `gulp sass` to transpile the SCSS file into CSS. 65 | - Push the your changes to your fork and submit a PR. 66 | 67 | ## Credits 68 | -
Badger icon made by Freepik from www.flaticon.com is licensed by CC 3.0 BY
-------------------------------------------------------------------------------- /badgerly.css: -------------------------------------------------------------------------------- 1 | /***************************** 2 | * Badgerly 3 | * Written by Steven Hunt 4 | * MIT License 5 | *****************************/ 6 | /***************************** 7 | * Badgerly 8 | * Core styles for all shapes and colors 9 | * MIT License 10 | *****************************/ 11 | /* represents a badge, which has a ribbon and a shape. */ 12 | .badge { 13 | display: flex; 14 | flex-direction: column; 15 | overflow: hidden; 16 | position: relative; } 17 | .badge .border { 18 | border-style: solid; } 19 | .badge .border.gold { 20 | border-color: goldenrod; } 21 | .badge .border.silver { 22 | border-color: #cccccc; } 23 | .badge .border.bronze { 24 | border-color: sienna; } 25 | 26 | /* SHAPES */ 27 | .badge { 28 | /* common shape properties */ 29 | /* a diamond is a square rotated. */ 30 | /* rotate the contents of the diamond back so that it doesn't look weird. */ 31 | /* a badge can either have a simple ribbon, or a lanyard with a left and right ribbon. */ } 32 | .badge .circle, .badge .square, .badge .diamond { 33 | display: inline-block; 34 | margin: 0; 35 | padding: 0; 36 | z-index: 1000; } 37 | .badge .diamond { 38 | transform: rotate(45deg); } 39 | .badge .diamond > * { 40 | transform: rotate(-45deg); } 41 | .badge .lanyard { 42 | position: relative; 43 | overflow: hidden; 44 | /* common properties of the left and right ribbon in a lanyard. */ } 45 | .badge .lanyard .ribbon.left, .badge .lanyard .ribbon.right { 46 | top: 0; 47 | position: absolute; 48 | z-index: 0; } 49 | .badge .ribbon { 50 | margin: 0; 51 | padding: 0; } 52 | 53 | /* COLORS */ 54 | .badge .gold { 55 | background: radial-gradient(gold, palegoldenrod); 56 | color: goldenrod; } 57 | 58 | .badge .silver { 59 | background: radial-gradient(#fafafa, #dddddd); 60 | color: #cccccc; } 61 | 62 | .badge .bronze { 63 | background: radial-gradient(darkorange, chocolate); 64 | color: sienna; } 65 | 66 | /* RIBBON PATTERNS */ 67 | /* COUNTRIES */ 68 | .badge { 69 | /* 13 red and white strips: United States */ 70 | /* red white and blue: Netherlands */ 71 | /* red white and green: Mexico, Hungary */ 72 | /* blue white and red: France */ 73 | /* red white and red: Canada */ 74 | /* green white and red: Italy */ 75 | /* red blue and white: Russia */ 76 | /* gold red and black: Germany */ 77 | /* orange white and green: India */ } 78 | .badge .ribbon.red-white-stripes, .badge .ribbon.usa { 79 | background: linear-gradient(to right, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red); } 80 | .badge .ribbon.red-white-blue, .badge .ribbon.netherlands { 81 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, white, white, white, white, white, white, blue, blue, blue, blue, blue, blue, blue, blue); } 82 | .badge .ribbon.red-white-green, .badge .ribbon.mexico, .badge .ribbon.hungary { 83 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, white, white, white, white, white, white, green, green, green, green, green, green, green, green); } 84 | .badge .ribbon.blue-white-red, .badge .ribbon.france { 85 | background: linear-gradient(to right, blue, blue, blue, blue, blue, blue, blue, blue, white, white, white, white, white, white, red, red, red, red, red, red, red, red); } 86 | .badge .ribbon.red-white-red, .badge .ribbon.canada { 87 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, white, white, white, white, white, white, white, white, white, red, red, red, red, red, red, red, red); } 88 | .badge .ribbon.green-white-red, .badge .ribbon.italy { 89 | background: linear-gradient(to right, green, green, green, green, green, green, green, green, white, white, white, white, white, white, red, red, red, red, red, red, red, red); } 90 | .badge .ribbon.red-blue-white, .badge .ribbon.russia { 91 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, blue, blue, blue, blue, blue, blue, white, white, white, white, white, white, white, white); } 92 | .badge .ribbon.gold-red-black, .badge .ribbon.germany { 93 | background: linear-gradient(to right, gold, gold, gold, gold, gold, gold, gold, gold, red, red, red, red, red, red, black, black, black, black, black, black, black, black); } 94 | .badge .ribbon.orange-white-green, .badge .ribbon.india { 95 | background: linear-gradient(to right, orange, orange, orange, orange, orange, orange, orange, orange, white, white, white, white, white, white, green, green, green, green, green, green, green, green); } 96 | 97 | /* SOLID COLORS */ 98 | .badge { 99 | /* Solid Red */ 100 | /* Solid Orange */ 101 | /* Solid Yellow */ 102 | /* Solid Green */ 103 | /* Solid Blue */ 104 | /* Solid Purple */ 105 | /* Solid Pink */ 106 | /* Solid Black */ 107 | /* RAINBOW */ } 108 | .badge .ribbon.red { 109 | background: linear-gradient(to right, red, darkred, red, darkred, red); } 110 | .badge .ribbon.orange { 111 | background: linear-gradient(to right, orange, darkorange, orange, darkorange, orange); } 112 | .badge .ribbon.yellow { 113 | background: linear-gradient(to right, yellow, gold, yellow, gold, yellow); } 114 | .badge .ribbon.green { 115 | background: linear-gradient(to right, green, darkgreen, green, darkgreen, green); } 116 | .badge .ribbon.blue { 117 | background: linear-gradient(to right, blue, darkblue, blue, darkblue, blue); } 118 | .badge .ribbon.purple { 119 | background: linear-gradient(to right, rebeccapurple, purple, rebeccapurple, purple, rebeccapurple); } 120 | .badge .ribbon.pink { 121 | background: linear-gradient(to right, pink, lightpink, pink, lightpink, pink); } 122 | .badge .ribbon.black { 123 | background: linear-gradient(to right, black, #333333, black, #333333, black); } 124 | .badge .ribbon.rainbow { 125 | background: linear-gradient(to right, red, red, orange, orange, yellow, yellow, green, green, blue, blue, purple, purple); } 126 | 127 | /* BADGE SIZES */ 128 | /* Tiny - really really small. No difference between border and no border since its too small to tell. */ 129 | /***************************** 130 | * Badgerly 131 | * Keep re-usable extension classes here. 132 | * These classes are not to be used directly in markup 133 | * MIT License 134 | *****************************/ 135 | .ext_circle_tiny, .badge.tiny .circle, .badge.tiny .circle.border { 136 | border-radius: 5px; 137 | font-size: 6px; 138 | text-align: center; } 139 | 140 | .ext_circle_small, .badge.small .circle, .badge.small .circle.border { 141 | border-radius: 12px; 142 | font-size: 15px; 143 | text-align: center; } 144 | 145 | .ext_circle_medium, .badge.medium .circle, .badge.medium .circle.border { 146 | border-radius: 25px; 147 | font-size: 30px; 148 | text-align: center; } 149 | 150 | .ext_circle_large, .badge.large .circle, .badge.large .circle.border { 151 | border-radius: 50px; 152 | font-size: 60px; 153 | text-align: center; } 154 | 155 | .ext_circle_huge, .badge.huge .circle, .badge.huge .circle.border { 156 | border-radius: 100px; 157 | font-size: 120px; 158 | text-align: center; } 159 | 160 | .badge.tiny .circle, .badge.tiny .circle.border { 161 | width: 10px; 162 | height: 8px; 163 | padding-top: 1px; } 164 | 165 | .badge.tiny .square, .badge.tiny .square.border, .badge.tiny .diamond, .badge.tiny .diamond.border { 166 | font-size: 6px; 167 | text-align: center; 168 | width: 10px; 169 | height: 8px; 170 | padding-top: 1px; } 171 | 172 | .badge.tiny .border { 173 | border-style: none; } 174 | 175 | .badge.tiny .lanyard { 176 | height: 6px; 177 | padding-left: 2px; 178 | margin-left: -2px; 179 | margin-right: -2px; 180 | margin-bottom: -1px; 181 | width: 12px; } 182 | .badge.tiny .lanyard .ribbon.left { 183 | transform: translate(-3px, 0) rotate(-20deg); } 184 | .badge.tiny .lanyard .ribbon.right { 185 | transform: scaleX(-1) translate(-3px, 0) rotate(-20deg); } 186 | 187 | .badge.tiny .ribbon { 188 | margin-bottom: -1px; 189 | margin-left: 3px; 190 | width: 4px; 191 | height: 5px; } 192 | 193 | /* Small */ 194 | /***************************** 195 | * Badgerly 196 | * Keep re-usable extension classes here. 197 | * These classes are not to be used directly in markup 198 | * MIT License 199 | *****************************/ 200 | .ext_circle_tiny, .badge.tiny .circle, .badge.tiny .circle.border { 201 | border-radius: 5px; 202 | font-size: 6px; 203 | text-align: center; } 204 | 205 | .ext_circle_small, .badge.small .circle, .badge.small .circle.border { 206 | border-radius: 12px; 207 | font-size: 15px; 208 | text-align: center; } 209 | 210 | .ext_circle_medium, .badge.medium .circle, .badge.medium .circle.border { 211 | border-radius: 25px; 212 | font-size: 30px; 213 | text-align: center; } 214 | 215 | .ext_circle_large, .badge.large .circle, .badge.large .circle.border { 216 | border-radius: 50px; 217 | font-size: 60px; 218 | text-align: center; } 219 | 220 | .ext_circle_huge, .badge.huge .circle, .badge.huge .circle.border { 221 | border-radius: 100px; 222 | font-size: 120px; 223 | text-align: center; } 224 | 225 | .badge.small { 226 | width: 30px; 227 | height: 37px; } 228 | .badge.small .circle { 229 | width: 25px; 230 | height: 20px; 231 | padding-top: 4px; } 232 | .badge.small .circle.border { 233 | width: 22px; 234 | height: 19px; 235 | padding-top: 3px; } 236 | .badge.small .square { 237 | font-size: 15px; 238 | text-align: center; 239 | width: 25px; 240 | height: 21px; 241 | padding-top: 3px; } 242 | .badge.small .square.border { 243 | font-size: 15px; 244 | text-align: center; 245 | width: 22px; 246 | height: 20px; 247 | padding-top: 2px; } 248 | .badge.small .diamond { 249 | font-size: 15px; 250 | text-align: center; 251 | width: 17px; 252 | height: 16px; 253 | padding-top: 0; 254 | padding-bottom: 1px; 255 | transform: translate(3px, 0) rotate(45deg); } 256 | .badge.small .diamond.border { 257 | font-size: 15px; 258 | text-align: center; 259 | width: 16px; 260 | height: 15px; 261 | padding-top: 0; 262 | padding-bottom: 1px; } 263 | .badge.small .border { 264 | border-width: 1px; } 265 | .badge.small .lanyard { 266 | height: 15px; 267 | padding-left: 5px; 268 | margin-left: -5px; 269 | margin-right: -5px; 270 | margin-bottom: -2px; 271 | width: 30px; } 272 | .badge.small .lanyard .ribbon { 273 | top: 2px; } 274 | .badge.small .lanyard .ribbon.left { 275 | transform: translate(-6px, 0) rotate(-15deg); } 276 | .badge.small .lanyard .ribbon.right { 277 | transform: scaleX(-1) translate(-6px, 0) rotate(-15deg); } 278 | .badge.small .ribbon { 279 | margin-bottom: -2px; 280 | margin-left: 7px; 281 | width: 10px; 282 | height: 12px; } 283 | 284 | /* Medium */ 285 | /***************************** 286 | * Badgerly 287 | * Keep re-usable extension classes here. 288 | * These classes are not to be used directly in markup 289 | * MIT License 290 | *****************************/ 291 | .ext_circle_tiny, .badge.tiny .circle, .badge.tiny .circle.border { 292 | border-radius: 5px; 293 | font-size: 6px; 294 | text-align: center; } 295 | 296 | .ext_circle_small, .badge.small .circle, .badge.small .circle.border { 297 | border-radius: 12px; 298 | font-size: 15px; 299 | text-align: center; } 300 | 301 | .ext_circle_medium, .badge.medium .circle, .badge.medium .circle.border { 302 | border-radius: 25px; 303 | font-size: 30px; 304 | text-align: center; } 305 | 306 | .ext_circle_large, .badge.large .circle, .badge.large .circle.border { 307 | border-radius: 50px; 308 | font-size: 60px; 309 | text-align: center; } 310 | 311 | .ext_circle_huge, .badge.huge .circle, .badge.huge .circle.border { 312 | border-radius: 100px; 313 | font-size: 120px; 314 | text-align: center; } 315 | 316 | .badge.medium { 317 | width: 60px; 318 | height: 75px; } 319 | .badge.medium .circle { 320 | width: 50px; 321 | height: 42px; 322 | padding-top: 7px; } 323 | .badge.medium .circle.border { 324 | width: 45px; 325 | height: 40px; 326 | padding-top: 5px; } 327 | .badge.medium .square { 328 | font-size: 30px; 329 | text-align: center; 330 | width: 50px; 331 | height: 42px; 332 | padding-top: 7px; } 333 | .badge.medium .square.border { 334 | font-size: 30px; 335 | text-align: center; 336 | width: 45px; 337 | height: 40px; 338 | padding-top: 5px; } 339 | .badge.medium .diamond { 340 | font-size: 30px; 341 | text-align: center; 342 | width: 34px; 343 | height: 32px; 344 | padding-top: 0; 345 | padding-bottom: 2px; 346 | transform: translate(7px, 0) rotate(45deg); } 347 | .badge.medium .diamond.border { 348 | font-size: 30px; 349 | text-align: center; 350 | width: 32px; 351 | height: 30px; 352 | padding-top: 0; 353 | padding-bottom: 2px; } 354 | .badge.medium .border { 355 | border-width: 2px; } 356 | .badge.medium .lanyard { 357 | height: 30px; 358 | padding-left: 10px; 359 | margin-left: -10px; 360 | margin-right: -10px; 361 | margin-bottom: -5px; 362 | width: 60px; } 363 | .badge.medium .lanyard .ribbon { 364 | top: 5px; } 365 | .badge.medium .lanyard .ribbon.left { 366 | transform: translate(-13px, 0) rotate(-15deg); } 367 | .badge.medium .lanyard .ribbon.right { 368 | transform: scaleX(-1) translate(-13px, 0) rotate(-15deg); } 369 | .badge.medium .ribbon { 370 | margin-bottom: -5px; 371 | margin-left: 15px; 372 | width: 20px; 373 | height: 25px; } 374 | 375 | /* Large */ 376 | /***************************** 377 | * Badgerly 378 | * Keep re-usable extension classes here. 379 | * These classes are not to be used directly in markup 380 | * MIT License 381 | *****************************/ 382 | .ext_circle_tiny, .badge.tiny .circle, .badge.tiny .circle.border { 383 | border-radius: 5px; 384 | font-size: 6px; 385 | text-align: center; } 386 | 387 | .ext_circle_small, .badge.small .circle, .badge.small .circle.border { 388 | border-radius: 12px; 389 | font-size: 15px; 390 | text-align: center; } 391 | 392 | .ext_circle_medium, .badge.medium .circle, .badge.medium .circle.border { 393 | border-radius: 25px; 394 | font-size: 30px; 395 | text-align: center; } 396 | 397 | .ext_circle_large, .badge.large .circle, .badge.large .circle.border { 398 | border-radius: 50px; 399 | font-size: 60px; 400 | text-align: center; } 401 | 402 | .ext_circle_huge, .badge.huge .circle, .badge.huge .circle.border { 403 | border-radius: 100px; 404 | font-size: 120px; 405 | text-align: center; } 406 | 407 | .badge.large { 408 | width: 120px; 409 | height: 150px; } 410 | .badge.large .circle { 411 | width: 100px; 412 | height: 85px; 413 | padding-top: 15px; } 414 | .badge.large .circle.border { 415 | width: 90px; 416 | height: 80px; 417 | padding-top: 10px; } 418 | .badge.large .square { 419 | font-size: 60px; 420 | text-align: center; 421 | width: 100px; 422 | height: 85px; 423 | padding-top: 15px; } 424 | .badge.large .square.border { 425 | font-size: 60px; 426 | text-align: center; 427 | width: 90px; 428 | height: 80px; 429 | padding-top: 10px; } 430 | .badge.large .diamond { 431 | font-size: 60px; 432 | text-align: center; 433 | width: 69px; 434 | height: 65px; 435 | padding-top: 0; 436 | padding-bottom: 4px; 437 | transform: translate(14px, 0) rotate(45deg); } 438 | .badge.large .diamond.border { 439 | font-size: 60px; 440 | text-align: center; 441 | width: 64px; 442 | height: 60px; 443 | padding-top: 0; 444 | padding-bottom: 4px; } 445 | .badge.large .border { 446 | border-width: 5px; } 447 | .badge.large .lanyard { 448 | height: 60px; 449 | padding-left: 20px; 450 | margin-left: -20px; 451 | margin-right: -20px; 452 | margin-bottom: -16px; 453 | width: 120px; } 454 | .badge.large .lanyard .ribbon { 455 | top: 5px; } 456 | .badge.large .lanyard .ribbon.left { 457 | transform: translate(-25px, 0) rotate(-15deg); } 458 | .badge.large .lanyard .ribbon.right { 459 | transform: scaleX(-1) translate(-25px, 0) rotate(-15deg); } 460 | .badge.large .ribbon { 461 | margin-bottom: -10px; 462 | margin-left: 30px; 463 | width: 40px; 464 | height: 50px; } 465 | 466 | /* Huge - possibly with a Y. */ 467 | /***************************** 468 | * Badgerly 469 | * Keep re-usable extension classes here. 470 | * These classes are not to be used directly in markup 471 | * MIT License 472 | *****************************/ 473 | .ext_circle_tiny, .badge.tiny .circle, .badge.tiny .circle.border { 474 | border-radius: 5px; 475 | font-size: 6px; 476 | text-align: center; } 477 | 478 | .ext_circle_small, .badge.small .circle, .badge.small .circle.border { 479 | border-radius: 12px; 480 | font-size: 15px; 481 | text-align: center; } 482 | 483 | .ext_circle_medium, .badge.medium .circle, .badge.medium .circle.border { 484 | border-radius: 25px; 485 | font-size: 30px; 486 | text-align: center; } 487 | 488 | .ext_circle_large, .badge.large .circle, .badge.large .circle.border { 489 | border-radius: 50px; 490 | font-size: 60px; 491 | text-align: center; } 492 | 493 | .ext_circle_huge, .badge.huge .circle, .badge.huge .circle.border { 494 | border-radius: 100px; 495 | font-size: 120px; 496 | text-align: center; } 497 | 498 | .badge.huge { 499 | width: 240px; 500 | height: 300px; } 501 | .badge.huge .circle { 502 | width: 200px; 503 | height: 170px; 504 | padding-top: 30px; } 505 | .badge.huge .circle.border { 506 | width: 180px; 507 | height: 160px; 508 | padding-top: 20px; } 509 | .badge.huge .square { 510 | font-size: 120px; 511 | text-align: center; 512 | width: 200px; 513 | height: 170px; 514 | padding-top: 30px; } 515 | .badge.huge .square.border { 516 | font-size: 120px; 517 | text-align: center; 518 | width: 180px; 519 | height: 160px; 520 | padding-top: 20px; } 521 | .badge.huge .diamond { 522 | font-size: 120px; 523 | text-align: center; 524 | width: 138px; 525 | height: 130px; 526 | padding-top: 0; 527 | padding-bottom: 8px; 528 | transform: translate(28px, 0) rotate(45deg); } 529 | .badge.huge .diamond.border { 530 | font-size: 120px; 531 | text-align: center; 532 | width: 128px; 533 | height: 120px; 534 | padding-top: 0; 535 | padding-bottom: 8px; } 536 | .badge.huge .border { 537 | border-width: 10px; } 538 | .badge.huge .lanyard { 539 | height: 120px; 540 | padding-left: 40px; 541 | margin-left: -40px; 542 | margin-right: -40px; 543 | margin-bottom: -32px; 544 | width: 240px; } 545 | .badge.huge .lanyard .ribbon { 546 | top: 10px; } 547 | .badge.huge .lanyard .ribbon.left { 548 | transform: translate(-50px, 0) rotate(-15deg); } 549 | .badge.huge .lanyard .ribbon.right { 550 | transform: scaleX(-1) translate(-50px, 0) rotate(-15deg); } 551 | .badge.huge .ribbon { 552 | margin-bottom: -20px; 553 | margin-left: 60px; 554 | width: 80px; 555 | height: 100px; } 556 | -------------------------------------------------------------------------------- /badgerly.scss: -------------------------------------------------------------------------------- 1 | /***************************** 2 | * Badgerly 3 | * Written by Steven Hunt 4 | * MIT License 5 | *****************************/ 6 | 7 | @import "src/core"; 8 | 9 | /* SHAPES */ 10 | @import "src/badge-shape"; 11 | 12 | /* COLORS */ 13 | @import "src/badge-colors"; 14 | 15 | /* RIBBON PATTERNS */ 16 | 17 | /* COUNTRIES */ 18 | @import "src/countries"; 19 | 20 | /* SOLID COLORS */ 21 | @import "src/ribbon-colors"; 22 | 23 | /* BADGE SIZES */ 24 | 25 | /* Tiny - really really small. No difference between border and no border since its too small to tell. */ 26 | @import "src/sizes/tiny"; 27 | 28 | /* Small */ 29 | @import "src/sizes/small"; 30 | 31 | /* Medium */ 32 | @import "src/sizes/medium"; 33 | 34 | /* Large */ 35 | @import "src/sizes/large"; 36 | 37 | /* Huge - possibly with a Y. */ 38 | @import "src/sizes/huge"; 39 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "badgerly", 3 | "homepage": "https://github.com/stevenmhunt/badgerly", 4 | "authors": [ 5 | "Steven Hunt " 6 | ], 7 | "description": "A CSS 3 library for rendering badges.", 8 | "main": "badgerly.css", 9 | "keywords": [ 10 | "css", 11 | "badge", 12 | "medal", 13 | "ribbon", 14 | "achievement", 15 | "gamification", 16 | "award" 17 | ], 18 | "license": "MIT", 19 | "ignore": [ 20 | "**/.*", 21 | "node_modules", 22 | "bower_components", 23 | "test", 24 | "tests" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var gulp = require('gulp'), 4 | sass = require('gulp-sass'), 5 | scssPaths = ['./src/**/*.scss', './*.scss']; 6 | 7 | gulp.task('sass', function () { 8 | return gulp.src(scssPaths) 9 | .pipe(sass().on('error', sass.logError)) 10 | .pipe(gulp.dest('.')); 11 | }); 12 | 13 | gulp.task('sass:watch', function () { 14 | gulp.watch(scssPaths, ['sass']); 15 | }); 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "badgerly", 3 | "version": "0.2.0", 4 | "description": "A CSS 3 library for rendering badges.", 5 | "main": "badgerly.css", 6 | "dependencies": {}, 7 | "devDependencies": { 8 | "gulp": "^3.9.1", 9 | "gulp-sass": "^2.3.2" 10 | }, 11 | "scripts": { 12 | "test": "echo \"Error: no test specified\" && exit 1", 13 | "build": "gulp sass", 14 | "watch": "gulp sass:watch" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "git+https://github.com/stevenmhunt/badgerly.git" 19 | }, 20 | "keywords": [ 21 | "css", 22 | "badge", 23 | "medal", 24 | "ribbon", 25 | "achievement", 26 | "gamification", 27 | "award" 28 | ], 29 | "author": "Steven Hunt", 30 | "license": "MIT", 31 | "bugs": { 32 | "url": "https://github.com/stevenmhunt/badgerly/issues" 33 | }, 34 | "homepage": "https://github.com/stevenmhunt/badgerly#readme" 35 | } 36 | -------------------------------------------------------------------------------- /src/_badge-colors.scss: -------------------------------------------------------------------------------- 1 | .badge { 2 | 3 | .gold { 4 | background: radial-gradient(gold, palegoldenrod); 5 | color: goldenrod; 6 | } 7 | 8 | .silver { 9 | background: radial-gradient(#fafafa, #dddddd); 10 | color: #cccccc; 11 | } 12 | 13 | .bronze { 14 | background: radial-gradient(darkorange, chocolate); 15 | color: sienna; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/_badge-shape.scss: -------------------------------------------------------------------------------- 1 | .badge { 2 | 3 | /* common shape properties */ 4 | .circle, .square, .diamond { 5 | display: inline-block; 6 | margin: 0; 7 | padding: 0; 8 | z-index: 1000; 9 | } 10 | 11 | /* a diamond is a square rotated. */ 12 | .diamond { 13 | transform: rotate(45deg); 14 | } 15 | 16 | /* rotate the contents of the diamond back so that it doesn't look weird. */ 17 | .diamond > * { 18 | transform: rotate(-45deg); 19 | } 20 | 21 | /* a badge can either have a simple ribbon, or a lanyard with a left and right ribbon. */ 22 | .lanyard { 23 | position: relative; 24 | overflow: hidden; 25 | 26 | /* common properties of the left and right ribbon in a lanyard. */ 27 | .ribbon.left, .ribbon.right { 28 | top: 0; 29 | position: absolute; 30 | z-index: 0; 31 | } 32 | } 33 | 34 | .ribbon { 35 | margin: 0; 36 | padding: 0; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/_core.scss: -------------------------------------------------------------------------------- 1 | /***************************** 2 | * Badgerly 3 | * Core styles for all shapes and colors 4 | * MIT License 5 | *****************************/ 6 | 7 | /* represents a badge, which has a ribbon and a shape. */ 8 | .badge { 9 | display: flex; 10 | flex-direction: column; 11 | overflow: hidden; 12 | position: relative; 13 | 14 | .border { 15 | border-style: solid; 16 | 17 | &.gold { 18 | border-color: goldenrod; 19 | } 20 | 21 | &.silver { 22 | border-color: #cccccc; 23 | } 24 | 25 | &.bronze { 26 | border-color: sienna; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/_countries.scss: -------------------------------------------------------------------------------- 1 | .badge { 2 | 3 | /* 13 red and white strips: United States */ 4 | .ribbon.red-white-stripes, .ribbon.usa { 5 | background: linear-gradient(to right, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red, white, white, white, red, red, red) 6 | } 7 | 8 | /* red white and blue: Netherlands */ 9 | .ribbon.red-white-blue, .ribbon.netherlands { 10 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, white, white, white, white, white, white, blue, blue, blue, blue, blue, blue, blue, blue); 11 | } 12 | 13 | /* red white and green: Mexico, Hungary */ 14 | .ribbon.red-white-green, .ribbon.mexico, .ribbon.hungary { 15 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, white, white, white, white, white, white, green, green, green, green, green, green, green, green); 16 | } 17 | 18 | /* blue white and red: France */ 19 | .ribbon.blue-white-red, .ribbon.france { 20 | background: linear-gradient(to right, blue, blue, blue, blue, blue, blue, blue, blue, white, white, white, white, white, white, red, red, red, red, red, red, red, red); 21 | } 22 | 23 | /* red white and red: Canada */ 24 | .ribbon.red-white-red, .ribbon.canada { 25 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, white, white, white, white, white, white, white, white, white, red, red, red, red, red, red, red, red); 26 | } 27 | 28 | /* green white and red: Italy */ 29 | .ribbon.green-white-red, .ribbon.italy { 30 | background: linear-gradient(to right, green, green, green, green, green, green, green, green, white, white, white, white, white, white, red, red, red, red, red, red, red, red); 31 | } 32 | 33 | /* red blue and white: Russia */ 34 | .ribbon.red-blue-white, .ribbon.russia { 35 | background: linear-gradient(to right, red, red, red, red, red, red, red, red, blue, blue, blue, blue, blue, blue, white, white, white, white, white, white, white, white); 36 | } 37 | 38 | /* gold red and black: Germany */ 39 | .ribbon.gold-red-black, .ribbon.germany { 40 | background: linear-gradient(to right, gold, gold, gold, gold, gold, gold, gold, gold, red, red, red, red, red, red, black, black, black, black, black, black, black, black); 41 | } 42 | 43 | /* orange white and green: India */ 44 | .ribbon.orange-white-green, .ribbon.india { 45 | background: linear-gradient(to right, orange, orange, orange, orange, orange, orange, orange, orange, white, white, white, white, white, white, green, green, green, green, green, green, green, green); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/_extensions.scss: -------------------------------------------------------------------------------- 1 | /***************************** 2 | * Badgerly 3 | * Keep re-usable extension classes here. 4 | * These classes are not to be used directly in markup 5 | * MIT License 6 | *****************************/ 7 | 8 | .ext_circle_tiny { 9 | border-radius: 5px; 10 | font-size: 6px; 11 | text-align: center; 12 | } 13 | 14 | .ext_circle_small { 15 | border-radius: 12px; 16 | font-size: 15px; 17 | text-align: center; 18 | } 19 | 20 | .ext_circle_medium { 21 | border-radius: 25px; 22 | font-size: 30px; 23 | text-align: center; 24 | } 25 | 26 | .ext_circle_large { 27 | border-radius: 50px; 28 | font-size: 60px; 29 | text-align: center; 30 | } 31 | 32 | .ext_circle_huge { 33 | border-radius: 100px; 34 | font-size: 120px; 35 | text-align: center; 36 | } 37 | -------------------------------------------------------------------------------- /src/_ribbon-colors.scss: -------------------------------------------------------------------------------- 1 | .badge { 2 | 3 | /* Solid Red */ 4 | .ribbon.red { 5 | background: linear-gradient(to right, red, darkred, red, darkred, red); 6 | } 7 | 8 | /* Solid Orange */ 9 | .ribbon.orange { 10 | background: linear-gradient(to right, orange, darkorange, orange, darkorange, orange); 11 | } 12 | 13 | /* Solid Yellow */ 14 | .ribbon.yellow { 15 | background: linear-gradient(to right, yellow, gold, yellow, gold, yellow); 16 | } 17 | 18 | /* Solid Green */ 19 | .ribbon.green { 20 | background: linear-gradient(to right, green, darkgreen, green, darkgreen, green); 21 | } 22 | 23 | /* Solid Blue */ 24 | .ribbon.blue { 25 | background: linear-gradient(to right, blue, darkblue, blue, darkblue, blue); 26 | } 27 | 28 | /* Solid Purple */ 29 | .ribbon.purple { 30 | background: linear-gradient(to right, rebeccapurple, purple, rebeccapurple, purple, rebeccapurple); 31 | } 32 | 33 | /* Solid Pink */ 34 | .ribbon.pink { 35 | background: linear-gradient(to right, pink, lightpink, pink, lightpink, pink); 36 | } 37 | 38 | /* Solid Black */ 39 | .ribbon.black { 40 | background: linear-gradient(to right, black, #333333, black, #333333, black); 41 | } 42 | 43 | /* RAINBOW */ 44 | .ribbon.rainbow { 45 | background: linear-gradient(to right, red, red, orange, orange, yellow, yellow, green, green, blue, blue, purple, purple); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/sizes/_huge.scss: -------------------------------------------------------------------------------- 1 | @import "../extensions"; 2 | 3 | .badge.huge { 4 | width: 240px; 5 | height: 300px; 6 | 7 | .circle { 8 | @extend .ext_circle_huge; 9 | width: 200px; 10 | height: 170px; 11 | padding-top: 30px; 12 | } 13 | 14 | .circle.border { 15 | @extend .ext_circle_huge; 16 | width: 180px; 17 | height: 160px; 18 | padding-top: 20px; 19 | } 20 | 21 | .square { 22 | font-size: 120px; 23 | text-align: center; 24 | width: 200px; 25 | height: 170px; 26 | padding-top: 30px; 27 | } 28 | 29 | .square.border { 30 | font-size: 120px; 31 | text-align: center; 32 | width: 180px; 33 | height: 160px; 34 | padding-top: 20px; 35 | } 36 | 37 | .diamond { 38 | font-size: 120px; 39 | text-align: center; 40 | width: 138px; 41 | height: 130px; 42 | padding-top: 0; 43 | padding-bottom: 8px; 44 | transform: translate(28px, 0) rotate(45deg); 45 | } 46 | 47 | .diamond.border { 48 | font-size: 120px; 49 | text-align: center; 50 | width: 128px; 51 | height: 120px; 52 | padding-top: 0; 53 | padding-bottom: 8px; 54 | } 55 | 56 | .border { 57 | border-width: 10px; 58 | } 59 | 60 | .lanyard { 61 | height: 120px; 62 | padding-left: 40px; 63 | margin-left: -40px; 64 | margin-right: -40px; 65 | margin-bottom: -32px; 66 | width: 240px; 67 | 68 | .ribbon { 69 | top: 10px; 70 | } 71 | .ribbon.left { 72 | transform: translate(-50px, 0) rotate(-15deg); 73 | } 74 | .ribbon.right { 75 | transform: scaleX(-1) translate(-50px, 0) rotate(-15deg); 76 | } 77 | } 78 | 79 | .ribbon { 80 | margin-bottom: -20px; 81 | margin-left: 60px; 82 | width: 80px; 83 | height: 100px; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/sizes/_large.scss: -------------------------------------------------------------------------------- 1 | @import "../extensions"; 2 | 3 | .badge.large { 4 | width: 120px; 5 | height: 150px; 6 | 7 | .circle { 8 | @extend .ext_circle_large; 9 | width: 100px; 10 | height: 85px; 11 | padding-top: 15px; 12 | } 13 | 14 | .circle.border { 15 | @extend .ext_circle_large; 16 | width: 90px; 17 | height: 80px; 18 | padding-top: 10px; 19 | } 20 | 21 | .square { 22 | font-size: 60px; 23 | text-align: center; 24 | width: 100px; 25 | height: 85px; 26 | padding-top: 15px; 27 | } 28 | 29 | .square.border { 30 | font-size: 60px; 31 | text-align: center; 32 | width: 90px; 33 | height: 80px; 34 | padding-top: 10px; 35 | } 36 | 37 | .diamond { 38 | font-size: 60px; 39 | text-align: center; 40 | width: 69px; 41 | height: 65px; 42 | padding-top: 0; 43 | padding-bottom: 4px; 44 | transform: translate(14px, 0) rotate(45deg); 45 | } 46 | 47 | .diamond.border { 48 | font-size: 60px; 49 | text-align: center; 50 | width: 64px; 51 | height: 60px; 52 | padding-top: 0; 53 | padding-bottom: 4px; 54 | } 55 | 56 | .border { 57 | border-width: 5px; 58 | } 59 | 60 | .lanyard { 61 | height: 60px; 62 | padding-left: 20px; 63 | margin-left: -20px; 64 | margin-right: -20px; 65 | margin-bottom: -16px; 66 | width: 120px; 67 | 68 | .ribbon { 69 | top: 5px; 70 | } 71 | .ribbon.left { 72 | transform: translate(-25px, 0) rotate(-15deg); 73 | } 74 | .ribbon.right { 75 | transform: scaleX(-1) translate(-25px, 0) rotate(-15deg); 76 | } 77 | } 78 | 79 | .ribbon { 80 | margin-bottom: -10px; 81 | margin-left: 30px; 82 | width: 40px; 83 | height: 50px; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/sizes/_medium.scss: -------------------------------------------------------------------------------- 1 | @import "../extensions"; 2 | 3 | .badge.medium { 4 | width: 60px; 5 | height: 75px; 6 | 7 | .circle { 8 | @extend .ext_circle_medium; 9 | width: 50px; 10 | height: 42px; 11 | padding-top: 7px; 12 | } 13 | 14 | .circle.border { 15 | @extend .ext_circle_medium; 16 | width: 45px; 17 | height: 40px; 18 | padding-top: 5px; 19 | } 20 | 21 | .square { 22 | font-size: 30px; 23 | text-align: center; 24 | width: 50px; 25 | height: 42px; 26 | padding-top: 7px; 27 | } 28 | 29 | .square.border { 30 | font-size: 30px; 31 | text-align: center; 32 | width: 45px; 33 | height: 40px; 34 | padding-top: 5px; 35 | } 36 | 37 | .diamond { 38 | font-size: 30px; 39 | text-align: center; 40 | width: 34px; 41 | height: 32px; 42 | padding-top: 0; 43 | padding-bottom: 2px; 44 | transform: translate(7px, 0) rotate(45deg); 45 | } 46 | 47 | .diamond.border { 48 | font-size: 30px; 49 | text-align: center; 50 | width: 32px; 51 | height: 30px; 52 | padding-top: 0; 53 | padding-bottom: 2px; 54 | } 55 | 56 | .border { 57 | border-width: 2px; 58 | } 59 | 60 | .lanyard { 61 | height: 30px; 62 | padding-left: 10px; 63 | margin-left: -10px; 64 | margin-right: -10px; 65 | margin-bottom: -5px; 66 | width: 60px; 67 | 68 | .ribbon { 69 | top: 5px; 70 | } 71 | .ribbon.left { 72 | transform: translate(-13px, 0) rotate(-15deg); 73 | } 74 | .ribbon.right { 75 | transform: scaleX(-1) translate(-13px, 0) rotate(-15deg); 76 | } 77 | } 78 | 79 | .ribbon { 80 | margin-bottom: -5px; 81 | margin-left: 15px; 82 | width: 20px; 83 | height: 25px; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/sizes/_small.scss: -------------------------------------------------------------------------------- 1 | @import "../extensions"; 2 | 3 | .badge.small { 4 | width: 30px; 5 | height: 37px; 6 | 7 | .circle { 8 | @extend .ext_circle_small; 9 | width: 25px; 10 | height: 20px; 11 | padding-top: 4px; 12 | } 13 | 14 | .circle.border { 15 | @extend .ext_circle_small; 16 | width: 22px; 17 | height: 19px; 18 | padding-top: 3px; 19 | } 20 | 21 | .square { 22 | font-size: 15px; 23 | text-align: center; 24 | width: 25px; 25 | height: 21px; 26 | padding-top: 3px; 27 | } 28 | 29 | .square.border { 30 | font-size: 15px; 31 | text-align: center; 32 | width: 22px; 33 | height: 20px; 34 | padding-top: 2px; 35 | } 36 | 37 | .diamond { 38 | font-size: 15px; 39 | text-align: center; 40 | width: 17px; 41 | height: 16px; 42 | padding-top: 0; 43 | padding-bottom: 1px; 44 | transform: translate(3px, 0) rotate(45deg); 45 | } 46 | 47 | .diamond.border { 48 | font-size: 15px; 49 | text-align: center; 50 | width: 16px; 51 | height: 15px; 52 | padding-top: 0; 53 | padding-bottom: 1px; 54 | } 55 | 56 | .border { 57 | border-width: 1px; 58 | } 59 | 60 | .lanyard { 61 | height: 15px; 62 | padding-left: 5px; 63 | margin-left: -5px; 64 | margin-right: -5px; 65 | margin-bottom: -2px; 66 | width: 30px; 67 | 68 | .ribbon { 69 | top: 2px; 70 | } 71 | .ribbon.left { 72 | transform: translate(-6px, 0) rotate(-15deg); 73 | } 74 | .ribbon.right { 75 | transform: scaleX(-1) translate(-6px, 0) rotate(-15deg); 76 | } 77 | } 78 | 79 | .ribbon { 80 | margin-bottom: -2px; 81 | margin-left: 7px; 82 | width: 10px; 83 | height: 12px; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/sizes/_tiny.scss: -------------------------------------------------------------------------------- 1 | @import "../extensions"; 2 | 3 | .badge.tiny { 4 | 5 | .circle, .circle.border { 6 | @extend .ext_circle_tiny; 7 | width: 10px; 8 | height: 8px; 9 | padding-top: 1px; 10 | } 11 | 12 | .square, .square.border, .diamond, .diamond.border { 13 | font-size: 6px; 14 | text-align: center; 15 | width: 10px; 16 | height: 8px; 17 | padding-top: 1px; 18 | } 19 | 20 | .border { 21 | border-style: none; 22 | } 23 | 24 | .lanyard { 25 | height: 6px; 26 | padding-left: 2px; 27 | margin-left: -2px; 28 | margin-right: -2px; 29 | margin-bottom: -1px; 30 | width: 12px; 31 | 32 | .ribbon.left { 33 | transform: translate(-3px, 0) rotate(-20deg); 34 | } 35 | .ribbon.right { 36 | transform: scaleX(-1) translate(-3px, 0) rotate(-20deg); 37 | } 38 | } 39 | 40 | .ribbon { 41 | margin-bottom: -1px; 42 | margin-left: 3px; 43 | width: 4px; 44 | height: 5px; 45 | } 46 | } 47 | --------------------------------------------------------------------------------