ezii-os 1.1.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +11 -3
- data/Gemfile.lock +34 -17
- data/Procfile +1 -0
- data/app/assets/stylesheets/address_searches.scss +3 -0
- data/app/assets/stylesheets/application.css +6 -0
- data/app/assets/stylesheets/banal/documents.scss +3 -0
- data/app/assets/stylesheets/banal/employees.scss +3 -0
- data/app/assets/stylesheets/banal/links.scss +3 -0
- data/app/assets/stylesheets/banal/metadata.scss +3 -0
- data/app/assets/stylesheets/banal/related_objects.scss +3 -0
- data/app/assets/stylesheets/banal_complexes.scss +3 -0
- data/app/assets/stylesheets/comments.scss +3 -0
- data/app/assets/stylesheets/employees.scss +3 -0
- data/app/controllers/address_searches_controller.rb +76 -0
- data/app/controllers/banal/brainstorms_controller.rb +22 -2
- data/app/controllers/banal/documents_controller.rb +90 -0
- data/app/controllers/banal/employees_controller.rb +74 -0
- data/app/controllers/banal/links_controller.rb +82 -0
- data/app/controllers/banal/metadata_controller.rb +74 -0
- data/app/controllers/banal/projects_controller.rb +1 -1
- data/app/controllers/banal/related_objects_controller.rb +74 -0
- data/app/controllers/banal_complexes_controller.rb +74 -0
- data/app/controllers/comments_controller.rb +90 -0
- data/app/controllers/concerns/banal/related_object_creation_and_linking.rb +11 -0
- data/app/controllers/employees_controller.rb +74 -0
- data/app/helpers/address_searches_helper.rb +2 -0
- data/app/helpers/banal/documents_helper.rb +2 -0
- data/app/helpers/banal/employees_helper.rb +2 -0
- data/app/helpers/banal/links_helper.rb +2 -0
- data/app/helpers/banal/metadata_helper.rb +2 -0
- data/app/helpers/banal/related_objects_helper.rb +2 -0
- data/app/helpers/banal_complexes_helper.rb +2 -0
- data/app/helpers/comments_helper.rb +2 -0
- data/app/helpers/employees_helper.rb +2 -0
- data/app/javascript/packs/application.js +5 -0
- data/app/models/address_search.rb +2 -0
- data/app/models/banal/brainstorm.rb +3 -0
- data/app/models/banal/document.rb +4 -0
- data/app/models/banal/employee.rb +2 -0
- data/app/models/banal/link.rb +4 -0
- data/app/models/banal/metadatum.rb +2 -0
- data/app/models/banal/project.rb +5 -3
- data/app/models/banal/related_object.rb +5 -0
- data/app/models/banal_complex.rb +3 -0
- data/app/models/banal_dropbox_api.rb +8 -0
- data/app/models/comment.rb +4 -0
- data/app/models/employee.rb +2 -0
- data/app/models/ezii_os_path.rb +8 -0
- data/app/views/address_searches/_address_search.json.jbuilder +2 -0
- data/app/views/address_searches/_form.html.erb +27 -0
- data/app/views/address_searches/edit.html.erb +6 -0
- data/app/views/address_searches/index.html.erb +29 -0
- data/app/views/address_searches/index.json.jbuilder +1 -0
- data/app/views/address_searches/new.html.erb +5 -0
- data/app/views/address_searches/show.html.erb +18 -0
- data/app/views/address_searches/show.json.jbuilder +1 -0
- data/app/views/application/_navbar.html.erb +10 -0
- data/app/views/banal/brainstorms/_comment.html.erb +35 -0
- data/app/views/banal/brainstorms/_comments.html.erb +3 -0
- data/app/views/banal/brainstorms/_form.html.erb +0 -5
- data/app/views/banal/brainstorms/index.html.erb +29 -6
- data/app/views/banal/documents/_banal_document.json.jbuilder +2 -0
- data/app/views/banal/documents/_form.html.erb +61 -0
- data/app/views/banal/documents/edit.html.erb +6 -0
- data/app/views/banal/documents/index.html.erb +31 -0
- data/app/views/banal/documents/index.json.jbuilder +1 -0
- data/app/views/banal/documents/new.html.erb +32 -0
- data/app/views/banal/documents/show.html.erb +19 -0
- data/app/views/banal/documents/show.json.jbuilder +1 -0
- data/app/views/banal/employees/_banal_employee.json.jbuilder +2 -0
- data/app/views/banal/employees/_form.html.erb +77 -0
- data/app/views/banal/employees/edit.html.erb +6 -0
- data/app/views/banal/employees/index.html.erb +49 -0
- data/app/views/banal/employees/index.json.jbuilder +1 -0
- data/app/views/banal/employees/new.html.erb +5 -0
- data/app/views/banal/employees/show.html.erb +64 -0
- data/app/views/banal/employees/show.json.jbuilder +1 -0
- data/app/views/banal/links/_banal_link.json.jbuilder +2 -0
- data/app/views/banal/links/_form.html.erb +47 -0
- data/app/views/banal/links/edit.html.erb +6 -0
- data/app/views/banal/links/index.html.erb +31 -0
- data/app/views/banal/links/index.json.jbuilder +1 -0
- data/app/views/banal/links/new.html.erb +5 -0
- data/app/views/banal/links/show.html.erb +19 -0
- data/app/views/banal/links/show.json.jbuilder +1 -0
- data/app/views/banal/metadata/_banal_metadatum.json.jbuilder +2 -0
- data/app/views/banal/metadata/_form.html.erb +32 -0
- data/app/views/banal/metadata/edit.html.erb +6 -0
- data/app/views/banal/metadata/index.html.erb +31 -0
- data/app/views/banal/metadata/index.json.jbuilder +1 -0
- data/app/views/banal/metadata/new.html.erb +5 -0
- data/app/views/banal/metadata/show.html.erb +19 -0
- data/app/views/banal/metadata/show.json.jbuilder +1 -0
- data/app/views/banal/projects/_banal_project.json.jbuilder +1 -1
- data/app/views/banal/projects/_form.html.erb +40 -0
- data/app/views/banal/projects/index.html.erb +18 -4
- data/app/views/banal/projects/show.html.erb +65 -3
- data/app/views/banal/related_objects/_banal_related_object.json.jbuilder +2 -0
- data/app/views/banal/related_objects/_form.html.erb +27 -0
- data/app/views/banal/related_objects/_hidden_fields.html.erb +2 -0
- data/app/views/banal/related_objects/edit.html.erb +6 -0
- data/app/views/banal/related_objects/index.html.erb +29 -0
- data/app/views/banal/related_objects/index.json.jbuilder +1 -0
- data/app/views/banal/related_objects/new.html.erb +5 -0
- data/app/views/banal/related_objects/show.html.erb +14 -0
- data/app/views/banal/related_objects/show.json.jbuilder +1 -0
- data/app/views/banal_complexes/_banal_complex.json.jbuilder +2 -0
- data/app/views/banal_complexes/_form.html.erb +27 -0
- data/app/views/banal_complexes/edit.html.erb +6 -0
- data/app/views/banal_complexes/index.html.erb +42 -0
- data/app/views/banal_complexes/index.json.jbuilder +1 -0
- data/app/views/banal_complexes/new.html.erb +5 -0
- data/app/views/banal_complexes/show.html.erb +14 -0
- data/app/views/banal_complexes/show.json.jbuilder +1 -0
- data/app/views/comments/_comment.json.jbuilder +2 -0
- data/app/views/comments/_form.html.erb +32 -0
- data/app/views/comments/edit.html.erb +6 -0
- data/app/views/comments/index.html.erb +31 -0
- data/app/views/comments/index.json.jbuilder +1 -0
- data/app/views/comments/new.html.erb +5 -0
- data/app/views/comments/show.html.erb +19 -0
- data/app/views/comments/show.json.jbuilder +1 -0
- data/app/views/directories/show.html.erb +17 -3
- data/app/views/employees/_employee.json.jbuilder +2 -0
- data/app/views/employees/_form.html.erb +77 -0
- data/app/views/employees/edit.html.erb +6 -0
- data/app/views/employees/index.html.erb +49 -0
- data/app/views/employees/index.json.jbuilder +1 -0
- data/app/views/employees/new.html.erb +5 -0
- data/app/views/employees/show.html.erb +64 -0
- data/app/views/employees/show.json.jbuilder +1 -0
- data/app/views/layouts/application.html.erb +87 -5
- data/banal-data-science.bash +4 -0
- data/config/database.yml +3 -24
- data/config/routes.rb +24 -1
- data/db/development.sqlite3 +0 -0
- data/db/migrate/20190913073109_create_banal_projects.rb +17 -0
- data/db/migrate/20190913073110_create_banal_metadata.rb +11 -0
- data/db/migrate/20190913073111_create_banal_related_objects.rb +10 -0
- data/db/migrate/20190913143313_create_banal_documents.rb +11 -0
- data/db/migrate/20190913143326_create_banal_links.rb +11 -0
- data/db/migrate/20190915110713_add_dropbox_file_id_to_banal_documents.rb +5 -0
- data/db/migrate/20190915195312_add_deleted_at_to_banal_brainstorms.rb +6 -0
- data/db/migrate/20190915205450_create_employees.rb +20 -0
- data/db/migrate/20190915205629_create_banal_employees.rb +20 -0
- data/db/migrate/20190916094440_create_address_searches.rb +10 -0
- data/db/migrate/20190918222028_create_comments.rb +12 -0
- data/db/migrate/20190919164900_create_banal_complexes.rb +11 -0
- data/db/schema.rb +137 -7
- data/ezii-os-2.0.0.gem +0 -0
- data/ezii-os.gemspec +3 -4
- data/latest.dump +0 -0
- data/log/development.log +22199 -0
- data/node_modules/chart.js/LICENSE.md +9 -0
- data/node_modules/chart.js/README.md +32 -0
- data/node_modules/chart.js/bower.json +16 -0
- data/node_modules/chart.js/composer.json +26 -0
- data/node_modules/chart.js/dist/Chart.bundle.js +19288 -0
- data/node_modules/chart.js/dist/Chart.bundle.min.js +7 -0
- data/node_modules/chart.js/dist/Chart.css +47 -0
- data/node_modules/chart.js/dist/Chart.js +14680 -0
- data/node_modules/chart.js/dist/Chart.min.css +1 -0
- data/node_modules/chart.js/dist/Chart.min.js +7 -0
- data/node_modules/chart.js/package.json +69 -0
- data/node_modules/chartjs-color/CHANGELOG.md +35 -0
- data/node_modules/chartjs-color/LICENSE +21 -0
- data/node_modules/chartjs-color/README.md +126 -0
- data/node_modules/chartjs-color/index.js +485 -0
- data/node_modules/chartjs-color/node_modules/color-convert/CHANGELOG.md +4 -0
- data/node_modules/chartjs-color/node_modules/color-convert/LICENSE +21 -0
- data/node_modules/chartjs-color/node_modules/color-convert/README.md +57 -0
- data/node_modules/chartjs-color/node_modules/color-convert/component.json +9 -0
- data/node_modules/chartjs-color/node_modules/color-convert/conversions.js +698 -0
- data/node_modules/chartjs-color/node_modules/color-convert/index.js +92 -0
- data/node_modules/chartjs-color/node_modules/color-convert/package.json +20 -0
- data/node_modules/chartjs-color/node_modules/color-convert/test/basic.js +187 -0
- data/node_modules/chartjs-color/node_modules/color-convert/test/speed.js +23 -0
- data/node_modules/chartjs-color/package.json +49 -0
- data/node_modules/chartjs-color-string/CHANGELOG.md +11 -0
- data/node_modules/chartjs-color-string/LICENSE +21 -0
- data/node_modules/chartjs-color-string/README.md +46 -0
- data/node_modules/chartjs-color-string/color-string.js +237 -0
- data/node_modules/chartjs-color-string/package.json +24 -0
- data/node_modules/chartjs-color-string/test/basic.js +110 -0
- data/node_modules/chartkick/CHANGELOG.md +215 -0
- data/node_modules/chartkick/LICENSE.txt +22 -0
- data/node_modules/chartkick/README.md +537 -0
- data/node_modules/chartkick/dist/chartkick.esm.js +2286 -0
- data/node_modules/chartkick/dist/chartkick.js +2294 -0
- data/node_modules/chartkick/dist/chartkick.min.js +1 -0
- data/node_modules/chartkick/package.json +34 -0
- data/node_modules/{color-string → color-convert}/node_modules/color-name/LICENSE +0 -0
- data/node_modules/{color-string → color-convert}/node_modules/color-name/README.md +0 -0
- data/node_modules/{color-string → color-convert}/node_modules/color-name/index.js +0 -0
- data/node_modules/{color-string → color-convert}/node_modules/color-name/package.json +25 -28
- data/node_modules/{color-name → color-convert/node_modules/color-name}/test.js +0 -0
- data/node_modules/color-name/package.json +28 -25
- data/node_modules/moment/CHANGELOG.md +895 -0
- data/node_modules/moment/LICENSE +22 -0
- data/node_modules/moment/README.md +65 -0
- data/node_modules/moment/ender.js +1 -0
- data/node_modules/moment/locale/af.js +72 -0
- data/node_modules/moment/locale/ar-dz.js +58 -0
- data/node_modules/moment/locale/ar-kw.js +58 -0
- data/node_modules/moment/locale/ar-ly.js +121 -0
- data/node_modules/moment/locale/ar-ma.js +58 -0
- data/node_modules/moment/locale/ar-sa.js +103 -0
- data/node_modules/moment/locale/ar-tn.js +58 -0
- data/node_modules/moment/locale/ar.js +134 -0
- data/node_modules/moment/locale/az.js +104 -0
- data/node_modules/moment/locale/be.js +131 -0
- data/node_modules/moment/locale/bg.js +89 -0
- data/node_modules/moment/locale/bm.js +57 -0
- data/node_modules/moment/locale/bn.js +118 -0
- data/node_modules/moment/locale/bo.js +118 -0
- data/node_modules/moment/locale/br.js +107 -0
- data/node_modules/moment/locale/bs.js +150 -0
- data/node_modules/moment/locale/ca.js +87 -0
- data/node_modules/moment/locale/cs.js +171 -0
- data/node_modules/moment/locale/cv.js +62 -0
- data/node_modules/moment/locale/cy.js +79 -0
- data/node_modules/moment/locale/da.js +59 -0
- data/node_modules/moment/locale/de-at.js +75 -0
- data/node_modules/moment/locale/de-ch.js +75 -0
- data/node_modules/moment/locale/de.js +75 -0
- data/node_modules/moment/locale/dv.js +98 -0
- data/node_modules/moment/locale/el.js +99 -0
- data/node_modules/moment/locale/en-SG.js +66 -0
- data/node_modules/moment/locale/en-au.js +66 -0
- data/node_modules/moment/locale/en-ca.js +62 -0
- data/node_modules/moment/locale/en-gb.js +66 -0
- data/node_modules/moment/locale/en-ie.js +66 -0
- data/node_modules/moment/locale/en-il.js +61 -0
- data/node_modules/moment/locale/en-nz.js +66 -0
- data/node_modules/moment/locale/eo.js +70 -0
- data/node_modules/moment/locale/es-do.js +91 -0
- data/node_modules/moment/locale/es-us.js +91 -0
- data/node_modules/moment/locale/es.js +91 -0
- data/node_modules/moment/locale/et.js +79 -0
- data/node_modules/moment/locale/eu.js +65 -0
- data/node_modules/moment/locale/fa.js +105 -0
- data/node_modules/moment/locale/fi.js +108 -0
- data/node_modules/moment/locale/fo.js +59 -0
- data/node_modules/moment/locale/fr-ca.js +73 -0
- data/node_modules/moment/locale/fr-ch.js +77 -0
- data/node_modules/moment/locale/fr.js +82 -0
- data/node_modules/moment/locale/fy.js +74 -0
- data/node_modules/moment/locale/ga.js +76 -0
- data/node_modules/moment/locale/gd.js +75 -0
- data/node_modules/moment/locale/gl.js +76 -0
- data/node_modules/moment/locale/gom-latn.js +122 -0
- data/node_modules/moment/locale/gu.js +123 -0
- data/node_modules/moment/locale/he.js +96 -0
- data/node_modules/moment/locale/hi.js +123 -0
- data/node_modules/moment/locale/hr.js +153 -0
- data/node_modules/moment/locale/hu.js +109 -0
- data/node_modules/moment/locale/hy-am.js +94 -0
- data/node_modules/moment/locale/id.js +81 -0
- data/node_modules/moment/locale/is.js +131 -0
- data/node_modules/moment/locale/it-ch.js +68 -0
- data/node_modules/moment/locale/it.js +68 -0
- data/node_modules/moment/locale/ja.js +91 -0
- data/node_modules/moment/locale/jv.js +81 -0
- data/node_modules/moment/locale/ka.js +88 -0
- data/node_modules/moment/locale/kk.js +86 -0
- data/node_modules/moment/locale/km.js +109 -0
- data/node_modules/moment/locale/kn.js +125 -0
- data/node_modules/moment/locale/ko.js +80 -0
- data/node_modules/moment/locale/ku.js +118 -0
- data/node_modules/moment/locale/ky.js +86 -0
- data/node_modules/moment/locale/lb.js +135 -0
- data/node_modules/moment/locale/lo.js +69 -0
- data/node_modules/moment/locale/lt.js +117 -0
- data/node_modules/moment/locale/lv.js +96 -0
- data/node_modules/moment/locale/me.js +111 -0
- data/node_modules/moment/locale/mi.js +63 -0
- data/node_modules/moment/locale/mk.js +89 -0
- data/node_modules/moment/locale/ml.js +80 -0
- data/node_modules/moment/locale/mn.js +103 -0
- data/node_modules/moment/locale/mr.js +159 -0
- data/node_modules/moment/locale/ms-my.js +81 -0
- data/node_modules/moment/locale/ms.js +81 -0
- data/node_modules/moment/locale/mt.js +59 -0
- data/node_modules/moment/locale/my.js +92 -0
- data/node_modules/moment/locale/nb.js +61 -0
- data/node_modules/moment/locale/ne.js +122 -0
- data/node_modules/moment/locale/nl-be.js +86 -0
- data/node_modules/moment/locale/nl.js +86 -0
- data/node_modules/moment/locale/nn.js +59 -0
- data/node_modules/moment/locale/pa-in.js +123 -0
- data/node_modules/moment/locale/pl.js +125 -0
- data/node_modules/moment/locale/pt-br.js +60 -0
- data/node_modules/moment/locale/pt.js +64 -0
- data/node_modules/moment/locale/ro.js +74 -0
- data/node_modules/moment/locale/ru.js +181 -0
- data/node_modules/moment/locale/sd.js +97 -0
- data/node_modules/moment/locale/se.js +59 -0
- data/node_modules/moment/locale/si.js +70 -0
- data/node_modules/moment/locale/sk.js +155 -0
- data/node_modules/moment/locale/sl.js +172 -0
- data/node_modules/moment/locale/sq.js +67 -0
- data/node_modules/moment/locale/sr-cyrl.js +110 -0
- data/node_modules/moment/locale/sr.js +110 -0
- data/node_modules/moment/locale/ss.js +87 -0
- data/node_modules/moment/locale/sv.js +68 -0
- data/node_modules/moment/locale/sw.js +58 -0
- data/node_modules/moment/locale/ta.js +128 -0
- data/node_modules/moment/locale/te.js +88 -0
- data/node_modules/moment/locale/tet.js +66 -0
- data/node_modules/moment/locale/tg.js +115 -0
- data/node_modules/moment/locale/th.js +66 -0
- data/node_modules/moment/locale/tl-ph.js +61 -0
- data/node_modules/moment/locale/tlh.js +121 -0
- data/node_modules/moment/locale/tr.js +93 -0
- data/node_modules/moment/locale/tzl.js +90 -0
- data/node_modules/moment/locale/tzm-latn.js +57 -0
- data/node_modules/moment/locale/tzm.js +57 -0
- data/node_modules/moment/locale/ug-cn.js +118 -0
- data/node_modules/moment/locale/uk.js +153 -0
- data/node_modules/moment/locale/ur.js +97 -0
- data/node_modules/moment/locale/uz-latn.js +57 -0
- data/node_modules/moment/locale/uz.js +57 -0
- data/node_modules/moment/locale/vi.js +78 -0
- data/node_modules/moment/locale/x-pseudo.js +67 -0
- data/node_modules/moment/locale/yo.js +59 -0
- data/node_modules/moment/locale/zh-cn.js +109 -0
- data/node_modules/moment/locale/zh-hk.js +102 -0
- data/node_modules/moment/locale/zh-tw.js +102 -0
- data/node_modules/moment/min/locales.js +10178 -0
- data/node_modules/moment/min/locales.min.js +1 -0
- data/node_modules/moment/min/moment-with-locales.js +14765 -0
- data/node_modules/moment/min/moment-with-locales.min.js +1 -0
- data/node_modules/moment/min/moment.min.js +1 -0
- data/node_modules/moment/moment.d.ts +736 -0
- data/node_modules/moment/moment.js +4602 -0
- data/node_modules/moment/package.js +11 -0
- data/node_modules/moment/package.json +99 -0
- data/node_modules/moment/src/lib/create/check-overflow.js +34 -0
- data/node_modules/moment/src/lib/create/date-from-array.js +35 -0
- data/node_modules/moment/src/lib/create/from-anything.js +110 -0
- data/node_modules/moment/src/lib/create/from-array.js +147 -0
- data/node_modules/moment/src/lib/create/from-object.js +16 -0
- data/node_modules/moment/src/lib/create/from-string-and-array.js +50 -0
- data/node_modules/moment/src/lib/create/from-string-and-format.js +113 -0
- data/node_modules/moment/src/lib/create/from-string.js +230 -0
- data/node_modules/moment/src/lib/create/local.js +5 -0
- data/node_modules/moment/src/lib/create/parsing-flags.js +26 -0
- data/node_modules/moment/src/lib/create/utc.js +5 -0
- data/node_modules/moment/src/lib/create/valid.js +50 -0
- data/node_modules/moment/src/lib/duration/abs.js +18 -0
- data/node_modules/moment/src/lib/duration/add-subtract.js +21 -0
- data/node_modules/moment/src/lib/duration/as.js +66 -0
- data/node_modules/moment/src/lib/duration/bubble.js +61 -0
- data/node_modules/moment/src/lib/duration/clone.js +6 -0
- data/node_modules/moment/src/lib/duration/constructor.js +44 -0
- data/node_modules/moment/src/lib/duration/create.js +122 -0
- data/node_modules/moment/src/lib/duration/duration.js +16 -0
- data/node_modules/moment/src/lib/duration/get.js +25 -0
- data/node_modules/moment/src/lib/duration/humanize.js +85 -0
- data/node_modules/moment/src/lib/duration/iso-string.js +64 -0
- data/node_modules/moment/src/lib/duration/prototype.js +53 -0
- data/node_modules/moment/src/lib/duration/valid.js +36 -0
- data/node_modules/moment/src/lib/format/format.js +92 -0
- data/node_modules/moment/src/lib/locale/base-config.js +44 -0
- data/node_modules/moment/src/lib/locale/calendar.js +15 -0
- data/node_modules/moment/src/lib/locale/constructor.js +5 -0
- data/node_modules/moment/src/lib/locale/en.js +15 -0
- data/node_modules/moment/src/lib/locale/formats.js +23 -0
- data/node_modules/moment/src/lib/locale/invalid.js +5 -0
- data/node_modules/moment/src/lib/locale/lists.js +93 -0
- data/node_modules/moment/src/lib/locale/locale.js +39 -0
- data/node_modules/moment/src/lib/locale/locales.js +197 -0
- data/node_modules/moment/src/lib/locale/ordinal.js +7 -0
- data/node_modules/moment/src/lib/locale/pre-post-format.js +3 -0
- data/node_modules/moment/src/lib/locale/prototype.js +69 -0
- data/node_modules/moment/src/lib/locale/relative.js +30 -0
- data/node_modules/moment/src/lib/locale/set.js +49 -0
- data/node_modules/moment/src/lib/moment/add-subtract.js +55 -0
- data/node_modules/moment/src/lib/moment/calendar.js +26 -0
- data/node_modules/moment/src/lib/moment/clone.js +5 -0
- data/node_modules/moment/src/lib/moment/compare.js +63 -0
- data/node_modules/moment/src/lib/moment/constructor.js +77 -0
- data/node_modules/moment/src/lib/moment/creation-data.js +9 -0
- data/node_modules/moment/src/lib/moment/diff.js +58 -0
- data/node_modules/moment/src/lib/moment/format.js +62 -0
- data/node_modules/moment/src/lib/moment/from.js +17 -0
- data/node_modules/moment/src/lib/moment/get-set.js +61 -0
- data/node_modules/moment/src/lib/moment/locale.js +34 -0
- data/node_modules/moment/src/lib/moment/min-max.js +63 -0
- data/node_modules/moment/src/lib/moment/moment.js +28 -0
- data/node_modules/moment/src/lib/moment/now.js +3 -0
- data/node_modules/moment/src/lib/moment/prototype.js +150 -0
- data/node_modules/moment/src/lib/moment/start-end-of.js +128 -0
- data/node_modules/moment/src/lib/moment/to-type.js +34 -0
- data/node_modules/moment/src/lib/moment/to.js +17 -0
- data/node_modules/moment/src/lib/moment/valid.js +15 -0
- data/node_modules/moment/src/lib/parse/regex.js +54 -0
- data/node_modules/moment/src/lib/parse/token.js +33 -0
- data/node_modules/moment/src/lib/units/aliases.js +30 -0
- data/node_modules/moment/src/lib/units/constants.js +9 -0
- data/node_modules/moment/src/lib/units/day-of-month.js +39 -0
- data/node_modules/moment/src/lib/units/day-of-week.js +367 -0
- data/node_modules/moment/src/lib/units/day-of-year.js +36 -0
- data/node_modules/moment/src/lib/units/hour.js +144 -0
- data/node_modules/moment/src/lib/units/millisecond.js +69 -0
- data/node_modules/moment/src/lib/units/minute.js +29 -0
- data/node_modules/moment/src/lib/units/month.js +290 -0
- data/node_modules/moment/src/lib/units/offset.js +235 -0
- data/node_modules/moment/src/lib/units/priorities.js +16 -0
- data/node_modules/moment/src/lib/units/quarter.js +32 -0
- data/node_modules/moment/src/lib/units/second.js +29 -0
- data/node_modules/moment/src/lib/units/timestamp.js +20 -0
- data/node_modules/moment/src/lib/units/timezone.js +16 -0
- data/node_modules/moment/src/lib/units/units.js +20 -0
- data/node_modules/moment/src/lib/units/week-calendar-utils.js +65 -0
- data/node_modules/moment/src/lib/units/week-year.js +107 -0
- data/node_modules/moment/src/lib/units/week.js +67 -0
- data/node_modules/moment/src/lib/units/year.js +75 -0
- data/node_modules/moment/src/lib/utils/abs-ceil.js +7 -0
- data/node_modules/moment/src/lib/utils/abs-floor.js +8 -0
- data/node_modules/moment/src/lib/utils/abs-round.js +7 -0
- data/node_modules/moment/src/lib/utils/compare-arrays.js +16 -0
- data/node_modules/moment/src/lib/utils/defaults.js +10 -0
- data/node_modules/moment/src/lib/utils/deprecate.js +55 -0
- data/node_modules/moment/src/lib/utils/extend.js +19 -0
- data/node_modules/moment/src/lib/utils/has-own-prop.js +3 -0
- data/node_modules/moment/src/lib/utils/hooks.js +13 -0
- data/node_modules/moment/src/lib/utils/index-of.js +18 -0
- data/node_modules/moment/src/lib/utils/is-array.js +3 -0
- data/node_modules/moment/src/lib/utils/is-date.js +3 -0
- data/node_modules/moment/src/lib/utils/is-function.js +3 -0
- data/node_modules/moment/src/lib/utils/is-number.js +3 -0
- data/node_modules/moment/src/lib/utils/is-object-empty.js +13 -0
- data/node_modules/moment/src/lib/utils/is-object.js +5 -0
- data/node_modules/moment/src/lib/utils/is-undefined.js +3 -0
- data/node_modules/moment/src/lib/utils/keys.js +19 -0
- data/node_modules/moment/src/lib/utils/map.js +7 -0
- data/node_modules/moment/src/lib/utils/mod.js +3 -0
- data/node_modules/moment/src/lib/utils/some.js +19 -0
- data/node_modules/moment/src/lib/utils/to-int.js +12 -0
- data/node_modules/moment/src/lib/utils/zero-fill.js +7 -0
- data/node_modules/moment/src/locale/af.js +64 -0
- data/node_modules/moment/src/locale/ar-dz.js +51 -0
- data/node_modules/moment/src/locale/ar-kw.js +50 -0
- data/node_modules/moment/src/locale/ar-ly.js +113 -0
- data/node_modules/moment/src/locale/ar-ma.js +52 -0
- data/node_modules/moment/src/locale/ar-sa.js +96 -0
- data/node_modules/moment/src/locale/ar-tn.js +51 -0
- data/node_modules/moment/src/locale/ar.js +128 -0
- data/node_modules/moment/src/locale/az.js +97 -0
- data/node_modules/moment/src/locale/be.js +126 -0
- data/node_modules/moment/src/locale/bg.js +82 -0
- data/node_modules/moment/src/locale/bm.js +50 -0
- data/node_modules/moment/src/locale/bn.js +110 -0
- data/node_modules/moment/src/locale/bo.js +111 -0
- data/node_modules/moment/src/locale/br.js +100 -0
- data/node_modules/moment/src/locale/bs.js +143 -0
- data/node_modules/moment/src/locale/ca.js +80 -0
- data/node_modules/moment/src/locale/cs.js +164 -0
- data/node_modules/moment/src/locale/cv.js +54 -0
- data/node_modules/moment/src/locale/cy.js +73 -0
- data/node_modules/moment/src/locale/da.js +51 -0
- data/node_modules/moment/src/locale/de-at.js +70 -0
- data/node_modules/moment/src/locale/de-ch.js +69 -0
- data/node_modules/moment/src/locale/de.js +69 -0
- data/node_modules/moment/src/locale/dv.js +90 -0
- data/node_modules/moment/src/locale/el.js +89 -0
- data/node_modules/moment/src/locale/en-SG.js +59 -0
- data/node_modules/moment/src/locale/en-au.js +58 -0
- data/node_modules/moment/src/locale/en-ca.js +54 -0
- data/node_modules/moment/src/locale/en-gb.js +59 -0
- data/node_modules/moment/src/locale/en-ie.js +59 -0
- data/node_modules/moment/src/locale/en-il.js +54 -0
- data/node_modules/moment/src/locale/en-nz.js +58 -0
- data/node_modules/moment/src/locale/eo.js +65 -0
- data/node_modules/moment/src/locale/es-do.js +83 -0
- data/node_modules/moment/src/locale/es-us.js +84 -0
- data/node_modules/moment/src/locale/es.js +83 -0
- data/node_modules/moment/src/locale/et.js +73 -0
- data/node_modules/moment/src/locale/eu.js +58 -0
- data/node_modules/moment/src/locale/fa.js +98 -0
- data/node_modules/moment/src/locale/fi.js +101 -0
- data/node_modules/moment/src/locale/fo.js +53 -0
- data/node_modules/moment/src/locale/fr-ca.js +66 -0
- data/node_modules/moment/src/locale/fr-ch.js +70 -0
- data/node_modules/moment/src/locale/fr.js +75 -0
- data/node_modules/moment/src/locale/fy.js +67 -0
- data/node_modules/moment/src/locale/ga.js +68 -0
- data/node_modules/moment/src/locale/gd.js +68 -0
- data/node_modules/moment/src/locale/gl.js +69 -0
- data/node_modules/moment/src/locale/gom-latn.js +114 -0
- data/node_modules/moment/src/locale/gu.js +115 -0
- data/node_modules/moment/src/locale/he.js +91 -0
- data/node_modules/moment/src/locale/hi.js +116 -0
- data/node_modules/moment/src/locale/hr.js +145 -0
- data/node_modules/moment/src/locale/hu.js +103 -0
- data/node_modules/moment/src/locale/hy-am.js +87 -0
- data/node_modules/moment/src/locale/id.js +74 -0
- data/node_modules/moment/src/locale/is.js +124 -0
- data/node_modules/moment/src/locale/it-ch.js +61 -0
- data/node_modules/moment/src/locale/it.js +62 -0
- data/node_modules/moment/src/locale/ja.js +84 -0
- data/node_modules/moment/src/locale/jv.js +74 -0
- data/node_modules/moment/src/locale/ka.js +81 -0
- data/node_modules/moment/src/locale/kk.js +78 -0
- data/node_modules/moment/src/locale/km.js +101 -0
- data/node_modules/moment/src/locale/kn.js +117 -0
- data/node_modules/moment/src/locale/ko.js +74 -0
- data/node_modules/moment/src/locale/ku.js +110 -0
- data/node_modules/moment/src/locale/ky.js +79 -0
- data/node_modules/moment/src/locale/lb.js +129 -0
- data/node_modules/moment/src/locale/lo.js +62 -0
- data/node_modules/moment/src/locale/lt.js +110 -0
- data/node_modules/moment/src/locale/lv.js +90 -0
- data/node_modules/moment/src/locale/me.js +103 -0
- data/node_modules/moment/src/locale/mi.js +55 -0
- data/node_modules/moment/src/locale/mk.js +82 -0
- data/node_modules/moment/src/locale/ml.js +73 -0
- data/node_modules/moment/src/locale/mn.js +96 -0
- data/node_modules/moment/src/locale/mr.js +153 -0
- data/node_modules/moment/src/locale/ms-my.js +75 -0
- data/node_modules/moment/src/locale/ms.js +74 -0
- data/node_modules/moment/src/locale/mt.js +51 -0
- data/node_modules/moment/src/locale/my.js +87 -0
- data/node_modules/moment/src/locale/nb.js +55 -0
- data/node_modules/moment/src/locale/ne.js +115 -0
- data/node_modules/moment/src/locale/nl-be.js +80 -0
- data/node_modules/moment/src/locale/nl.js +80 -0
- data/node_modules/moment/src/locale/nn.js +52 -0
- data/node_modules/moment/src/locale/pa-in.js +116 -0
- data/node_modules/moment/src/locale/pl.js +117 -0
- data/node_modules/moment/src/locale/pt-br.js +53 -0
- data/node_modules/moment/src/locale/pt.js +57 -0
- data/node_modules/moment/src/locale/ro.js +68 -0
- data/node_modules/moment/src/locale/ru.js +175 -0
- data/node_modules/moment/src/locale/sd.js +89 -0
- data/node_modules/moment/src/locale/se.js +52 -0
- data/node_modules/moment/src/locale/si.js +62 -0
- data/node_modules/moment/src/locale/sk.js +149 -0
- data/node_modules/moment/src/locale/sl.js +164 -0
- data/node_modules/moment/src/locale/sq.js +62 -0
- data/node_modules/moment/src/locale/sr-cyrl.js +102 -0
- data/node_modules/moment/src/locale/sr.js +102 -0
- data/node_modules/moment/src/locale/ss.js +81 -0
- data/node_modules/moment/src/locale/sv.js +61 -0
- data/node_modules/moment/src/locale/sw.js +51 -0
- data/node_modules/moment/src/locale/ta.js +121 -0
- data/node_modules/moment/src/locale/te.js +80 -0
- data/node_modules/moment/src/locale/tet.js +60 -0
- data/node_modules/moment/src/locale/tg.js +107 -0
- data/node_modules/moment/src/locale/th.js +58 -0
- data/node_modules/moment/src/locale/tl-ph.js +54 -0
- data/node_modules/moment/src/locale/tlh.js +113 -0
- data/node_modules/moment/src/locale/tr.js +90 -0
- data/node_modules/moment/src/locale/tzl.js +84 -0
- data/node_modules/moment/src/locale/tzm-latn.js +50 -0
- data/node_modules/moment/src/locale/tzm.js +50 -0
- data/node_modules/moment/src/locale/ug-cn.js +110 -0
- data/node_modules/moment/src/locale/uk.js +146 -0
- data/node_modules/moment/src/locale/ur.js +90 -0
- data/node_modules/moment/src/locale/uz-latn.js +50 -0
- data/node_modules/moment/src/locale/uz.js +50 -0
- data/node_modules/moment/src/locale/vi.js +71 -0
- data/node_modules/moment/src/locale/x-pseudo.js +59 -0
- data/node_modules/moment/src/locale/yo.js +51 -0
- data/node_modules/moment/src/locale/zh-cn.js +102 -0
- data/node_modules/moment/src/locale/zh-hk.js +96 -0
- data/node_modules/moment/src/locale/zh-tw.js +95 -0
- data/node_modules/moment/src/moment.js +95 -0
- data/package.json +2 -0
- data/public/packs/js/application-0619dab0850a6efc7438.js +38148 -0
- data/public/packs/js/application-0619dab0850a6efc7438.js.map +1 -0
- data/public/packs/js/application-20352c48a8043c0951ac.js +38148 -0
- data/public/packs/js/application-20352c48a8043c0951ac.js.map +1 -0
- data/public/packs/js/application-c5495aaaa9c6e6b908e8.js +38148 -0
- data/public/packs/js/application-c5495aaaa9c6e6b908e8.js.map +1 -0
- data/public/packs/manifest.json +4 -4
- data/random.rb +1 -0
- data/test/controllers/address_searches_controller_test.rb +48 -0
- data/test/controllers/banal/documents_controller_test.rb +48 -0
- data/test/controllers/banal/employees_controller_test.rb +48 -0
- data/test/controllers/banal/links_controller_test.rb +48 -0
- data/test/controllers/banal/metadata_controller_test.rb +48 -0
- data/test/controllers/banal/projects_controller_test.rb +2 -2
- data/test/controllers/banal/related_objects_controller_test.rb +48 -0
- data/test/controllers/banal_complexes_controller_test.rb +48 -0
- data/test/controllers/comments_controller_test.rb +48 -0
- data/test/controllers/employees_controller_test.rb +48 -0
- data/test/fixtures/address_searches.yml +9 -0
- data/test/fixtures/banal/documents.yml +11 -0
- data/test/fixtures/banal/employees.yml +29 -0
- data/test/fixtures/banal/links.yml +11 -0
- data/test/fixtures/banal/metadata.yml +11 -0
- data/test/fixtures/banal/projects.yml +16 -0
- data/test/fixtures/banal/related_objects.yml +9 -0
- data/test/fixtures/banal_complexes.yml +9 -0
- data/test/fixtures/comments.yml +11 -0
- data/test/fixtures/employees.yml +29 -0
- data/test/models/address_search_test.rb +7 -0
- data/test/models/banal/document_test.rb +7 -0
- data/test/models/banal/employee_test.rb +7 -0
- data/test/models/banal/link_test.rb +7 -0
- data/test/models/banal/metadatum_test.rb +7 -0
- data/test/models/banal/related_object_test.rb +7 -0
- data/test/models/banal_complex_test.rb +7 -0
- data/test/models/comment_test.rb +7 -0
- data/test/models/employee_test.rb +7 -0
- data/test/system/address_searches_test.rb +45 -0
- data/test/system/banal/documents_test.rb +47 -0
- data/test/system/banal/employees_test.rb +65 -0
- data/test/system/banal/links_test.rb +47 -0
- data/test/system/banal/metadata_test.rb +47 -0
- data/test/system/banal/projects_test.rb +16 -0
- data/test/system/banal/related_objects_test.rb +45 -0
- data/test/system/banal_complexes_test.rb +45 -0
- data/test/system/comments_test.rb +47 -0
- data/test/system/employees_test.rb +65 -0
- data/yarn.lock +38 -0
- metadata +587 -8
- data/db/migrate/20190912173649_create_banal_projects.rb +0 -9
@@ -0,0 +1,126 @@
|
|
1
|
+
# chartjs-color
|
2
|
+
|
3
|
+
[![npm](https://img.shields.io/npm/v/chartjs-color.svg?style=flat-square)](https://npmjs.com/package/chartjs-color) [![Travis](https://img.shields.io/travis/chartjs/chartjs-color.svg?style=flat-square)](https://travis-ci.org/chartjs/chartjs-color)
|
4
|
+
|
5
|
+
> JavaScript library for color conversion and manipulation with support for CSS color strings.
|
6
|
+
|
7
|
+
```js
|
8
|
+
var color = Color("#7743CE");
|
9
|
+
|
10
|
+
color.alpha(0.5).lighten(0.5);
|
11
|
+
|
12
|
+
console.log(color.hslString()); // "hsla(262, 59%, 81%, 0.5)"
|
13
|
+
```
|
14
|
+
|
15
|
+
## Install
|
16
|
+
|
17
|
+
```console
|
18
|
+
$ npm install color
|
19
|
+
```
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```js
|
24
|
+
var Color = require("color")
|
25
|
+
```
|
26
|
+
|
27
|
+
### Setters
|
28
|
+
|
29
|
+
```js
|
30
|
+
var color = Color("rgb(255, 255, 255)")
|
31
|
+
var color = Color({r: 255, g: 255, b: 255})
|
32
|
+
var color = Color().rgb(255, 255, 255)
|
33
|
+
var color = Color().rgb([255, 255, 255])
|
34
|
+
```
|
35
|
+
Pass any valid CSS color string into `Color()` or a hash of values. Also load in color values with `rgb()`, `hsl()`, `hsv()`, `hwb()`, and `cmyk()`.
|
36
|
+
|
37
|
+
```js
|
38
|
+
color.red(120)
|
39
|
+
```
|
40
|
+
Set the values for individual channels with `alpha`, `red`, `green`, `blue`, `hue`, `saturation` (hsl), `saturationv` (hsv), `lightness`, `whiteness`, `blackness`, `cyan`, `magenta`, `yellow`, `black`
|
41
|
+
|
42
|
+
### Getters
|
43
|
+
|
44
|
+
|
45
|
+
```js
|
46
|
+
color.rgb() // {r: 255, g: 255, b: 255}
|
47
|
+
```
|
48
|
+
Get a hash of the rgb values with `rgb()`, similarly for `hsl()`, `hsv()`, and `cmyk()`
|
49
|
+
|
50
|
+
```js
|
51
|
+
color.rgbArray() // [255, 255, 255]
|
52
|
+
```
|
53
|
+
Get an array of the values with `rgbArray()`, `hslArray()`, `hsvArray()`, and `cmykArray()`.
|
54
|
+
|
55
|
+
```js
|
56
|
+
color.red() // 255
|
57
|
+
```
|
58
|
+
Get the value for an individual channel.
|
59
|
+
|
60
|
+
### CSS Strings
|
61
|
+
|
62
|
+
```js
|
63
|
+
color.hslString() // "hsl(320, 50%, 100%)"
|
64
|
+
```
|
65
|
+
|
66
|
+
Different CSS String formats for the color are on `hexString`, `rgbString`, `percentString`, `hslString`, `hwbString`, and `keyword` (undefined if it's not a keyword color). `"rgba"` and `"hsla"` are used if the current alpha value of the color isn't `1`.
|
67
|
+
|
68
|
+
### Luminosity
|
69
|
+
|
70
|
+
```js
|
71
|
+
color.luminosity(); // 0.412
|
72
|
+
```
|
73
|
+
The [WCAG luminosity](http://www.w3.org/TR/WCAG20/#relativeluminancedef) of the color. 0 is black, 1 is white.
|
74
|
+
|
75
|
+
```js
|
76
|
+
color.contrast(Color("blue")) // 12
|
77
|
+
```
|
78
|
+
The [WCAG contrast ratio](http://www.w3.org/TR/WCAG20/#contrast-ratiodef) to another color, from 1 (same color) to 21 (contrast b/w white and black).
|
79
|
+
|
80
|
+
```js
|
81
|
+
color.light(); // true
|
82
|
+
color.dark(); // false
|
83
|
+
```
|
84
|
+
Get whether the color is "light" or "dark", useful for deciding text color.
|
85
|
+
|
86
|
+
### Manipulation
|
87
|
+
|
88
|
+
```js
|
89
|
+
color.negate() // rgb(0, 100, 255) -> rgb(255, 155, 0)
|
90
|
+
|
91
|
+
color.lighten(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%)
|
92
|
+
color.darken(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%)
|
93
|
+
|
94
|
+
color.saturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%)
|
95
|
+
color.desaturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 25%, 50%)
|
96
|
+
color.greyscale() // #5CBF54 -> #969696
|
97
|
+
|
98
|
+
color.whiten(0.5) // hwb(100, 50%, 50%) -> hwb(100, 75%, 50%)
|
99
|
+
color.blacken(0.5) // hwb(100, 50%, 50%) -> hwb(100, 50%, 75%)
|
100
|
+
|
101
|
+
color.clearer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 0.4)
|
102
|
+
color.opaquer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 1.0)
|
103
|
+
|
104
|
+
color.rotate(180) // hsl(60, 20%, 20%) -> hsl(240, 20%, 20%)
|
105
|
+
color.rotate(-90) // hsl(60, 20%, 20%) -> hsl(330, 20%, 20%)
|
106
|
+
|
107
|
+
color.mix(Color("yellow")) // cyan -> rgb(128, 255, 128)
|
108
|
+
color.mix(Color("yellow"), 0.3) // cyan -> rgb(77, 255, 179)
|
109
|
+
|
110
|
+
// chaining
|
111
|
+
color.green(100).greyscale().lighten(0.6)
|
112
|
+
```
|
113
|
+
|
114
|
+
### Clone
|
115
|
+
|
116
|
+
You can can create a copy of an existing color object using `clone()`:
|
117
|
+
|
118
|
+
```js
|
119
|
+
color.clone() // -> New color object
|
120
|
+
```
|
121
|
+
|
122
|
+
And more to come...
|
123
|
+
|
124
|
+
## Propers
|
125
|
+
|
126
|
+
The API was inspired by [color-js](https://github.com/brehaut/color-js). Manipulation functions by CSS tools like Sass, LESS, and Stylus.
|
@@ -0,0 +1,485 @@
|
|
1
|
+
/* MIT license */
|
2
|
+
var convert = require('color-convert');
|
3
|
+
var string = require('chartjs-color-string');
|
4
|
+
|
5
|
+
var Color = function (obj) {
|
6
|
+
if (obj instanceof Color) {
|
7
|
+
return obj;
|
8
|
+
}
|
9
|
+
if (!(this instanceof Color)) {
|
10
|
+
return new Color(obj);
|
11
|
+
}
|
12
|
+
|
13
|
+
this.valid = false;
|
14
|
+
this.values = {
|
15
|
+
rgb: [0, 0, 0],
|
16
|
+
hsl: [0, 0, 0],
|
17
|
+
hsv: [0, 0, 0],
|
18
|
+
hwb: [0, 0, 0],
|
19
|
+
cmyk: [0, 0, 0, 0],
|
20
|
+
alpha: 1
|
21
|
+
};
|
22
|
+
|
23
|
+
// parse Color() argument
|
24
|
+
var vals;
|
25
|
+
if (typeof obj === 'string') {
|
26
|
+
vals = string.getRgba(obj);
|
27
|
+
if (vals) {
|
28
|
+
this.setValues('rgb', vals);
|
29
|
+
} else if (vals = string.getHsla(obj)) {
|
30
|
+
this.setValues('hsl', vals);
|
31
|
+
} else if (vals = string.getHwb(obj)) {
|
32
|
+
this.setValues('hwb', vals);
|
33
|
+
}
|
34
|
+
} else if (typeof obj === 'object') {
|
35
|
+
vals = obj;
|
36
|
+
if (vals.r !== undefined || vals.red !== undefined) {
|
37
|
+
this.setValues('rgb', vals);
|
38
|
+
} else if (vals.l !== undefined || vals.lightness !== undefined) {
|
39
|
+
this.setValues('hsl', vals);
|
40
|
+
} else if (vals.v !== undefined || vals.value !== undefined) {
|
41
|
+
this.setValues('hsv', vals);
|
42
|
+
} else if (vals.w !== undefined || vals.whiteness !== undefined) {
|
43
|
+
this.setValues('hwb', vals);
|
44
|
+
} else if (vals.c !== undefined || vals.cyan !== undefined) {
|
45
|
+
this.setValues('cmyk', vals);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
};
|
49
|
+
|
50
|
+
Color.prototype = {
|
51
|
+
isValid: function () {
|
52
|
+
return this.valid;
|
53
|
+
},
|
54
|
+
rgb: function () {
|
55
|
+
return this.setSpace('rgb', arguments);
|
56
|
+
},
|
57
|
+
hsl: function () {
|
58
|
+
return this.setSpace('hsl', arguments);
|
59
|
+
},
|
60
|
+
hsv: function () {
|
61
|
+
return this.setSpace('hsv', arguments);
|
62
|
+
},
|
63
|
+
hwb: function () {
|
64
|
+
return this.setSpace('hwb', arguments);
|
65
|
+
},
|
66
|
+
cmyk: function () {
|
67
|
+
return this.setSpace('cmyk', arguments);
|
68
|
+
},
|
69
|
+
|
70
|
+
rgbArray: function () {
|
71
|
+
return this.values.rgb;
|
72
|
+
},
|
73
|
+
hslArray: function () {
|
74
|
+
return this.values.hsl;
|
75
|
+
},
|
76
|
+
hsvArray: function () {
|
77
|
+
return this.values.hsv;
|
78
|
+
},
|
79
|
+
hwbArray: function () {
|
80
|
+
var values = this.values;
|
81
|
+
if (values.alpha !== 1) {
|
82
|
+
return values.hwb.concat([values.alpha]);
|
83
|
+
}
|
84
|
+
return values.hwb;
|
85
|
+
},
|
86
|
+
cmykArray: function () {
|
87
|
+
return this.values.cmyk;
|
88
|
+
},
|
89
|
+
rgbaArray: function () {
|
90
|
+
var values = this.values;
|
91
|
+
return values.rgb.concat([values.alpha]);
|
92
|
+
},
|
93
|
+
hslaArray: function () {
|
94
|
+
var values = this.values;
|
95
|
+
return values.hsl.concat([values.alpha]);
|
96
|
+
},
|
97
|
+
alpha: function (val) {
|
98
|
+
if (val === undefined) {
|
99
|
+
return this.values.alpha;
|
100
|
+
}
|
101
|
+
this.setValues('alpha', val);
|
102
|
+
return this;
|
103
|
+
},
|
104
|
+
|
105
|
+
red: function (val) {
|
106
|
+
return this.setChannel('rgb', 0, val);
|
107
|
+
},
|
108
|
+
green: function (val) {
|
109
|
+
return this.setChannel('rgb', 1, val);
|
110
|
+
},
|
111
|
+
blue: function (val) {
|
112
|
+
return this.setChannel('rgb', 2, val);
|
113
|
+
},
|
114
|
+
hue: function (val) {
|
115
|
+
if (val) {
|
116
|
+
val %= 360;
|
117
|
+
val = val < 0 ? 360 + val : val;
|
118
|
+
}
|
119
|
+
return this.setChannel('hsl', 0, val);
|
120
|
+
},
|
121
|
+
saturation: function (val) {
|
122
|
+
return this.setChannel('hsl', 1, val);
|
123
|
+
},
|
124
|
+
lightness: function (val) {
|
125
|
+
return this.setChannel('hsl', 2, val);
|
126
|
+
},
|
127
|
+
saturationv: function (val) {
|
128
|
+
return this.setChannel('hsv', 1, val);
|
129
|
+
},
|
130
|
+
whiteness: function (val) {
|
131
|
+
return this.setChannel('hwb', 1, val);
|
132
|
+
},
|
133
|
+
blackness: function (val) {
|
134
|
+
return this.setChannel('hwb', 2, val);
|
135
|
+
},
|
136
|
+
value: function (val) {
|
137
|
+
return this.setChannel('hsv', 2, val);
|
138
|
+
},
|
139
|
+
cyan: function (val) {
|
140
|
+
return this.setChannel('cmyk', 0, val);
|
141
|
+
},
|
142
|
+
magenta: function (val) {
|
143
|
+
return this.setChannel('cmyk', 1, val);
|
144
|
+
},
|
145
|
+
yellow: function (val) {
|
146
|
+
return this.setChannel('cmyk', 2, val);
|
147
|
+
},
|
148
|
+
black: function (val) {
|
149
|
+
return this.setChannel('cmyk', 3, val);
|
150
|
+
},
|
151
|
+
|
152
|
+
hexString: function () {
|
153
|
+
return string.hexString(this.values.rgb);
|
154
|
+
},
|
155
|
+
rgbString: function () {
|
156
|
+
return string.rgbString(this.values.rgb, this.values.alpha);
|
157
|
+
},
|
158
|
+
rgbaString: function () {
|
159
|
+
return string.rgbaString(this.values.rgb, this.values.alpha);
|
160
|
+
},
|
161
|
+
percentString: function () {
|
162
|
+
return string.percentString(this.values.rgb, this.values.alpha);
|
163
|
+
},
|
164
|
+
hslString: function () {
|
165
|
+
return string.hslString(this.values.hsl, this.values.alpha);
|
166
|
+
},
|
167
|
+
hslaString: function () {
|
168
|
+
return string.hslaString(this.values.hsl, this.values.alpha);
|
169
|
+
},
|
170
|
+
hwbString: function () {
|
171
|
+
return string.hwbString(this.values.hwb, this.values.alpha);
|
172
|
+
},
|
173
|
+
keyword: function () {
|
174
|
+
return string.keyword(this.values.rgb, this.values.alpha);
|
175
|
+
},
|
176
|
+
|
177
|
+
rgbNumber: function () {
|
178
|
+
var rgb = this.values.rgb;
|
179
|
+
return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
|
180
|
+
},
|
181
|
+
|
182
|
+
luminosity: function () {
|
183
|
+
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
|
184
|
+
var rgb = this.values.rgb;
|
185
|
+
var lum = [];
|
186
|
+
for (var i = 0; i < rgb.length; i++) {
|
187
|
+
var chan = rgb[i] / 255;
|
188
|
+
lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
|
189
|
+
}
|
190
|
+
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
191
|
+
},
|
192
|
+
|
193
|
+
contrast: function (color2) {
|
194
|
+
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
|
195
|
+
var lum1 = this.luminosity();
|
196
|
+
var lum2 = color2.luminosity();
|
197
|
+
if (lum1 > lum2) {
|
198
|
+
return (lum1 + 0.05) / (lum2 + 0.05);
|
199
|
+
}
|
200
|
+
return (lum2 + 0.05) / (lum1 + 0.05);
|
201
|
+
},
|
202
|
+
|
203
|
+
level: function (color2) {
|
204
|
+
var contrastRatio = this.contrast(color2);
|
205
|
+
if (contrastRatio >= 7.1) {
|
206
|
+
return 'AAA';
|
207
|
+
}
|
208
|
+
|
209
|
+
return (contrastRatio >= 4.5) ? 'AA' : '';
|
210
|
+
},
|
211
|
+
|
212
|
+
dark: function () {
|
213
|
+
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
|
214
|
+
var rgb = this.values.rgb;
|
215
|
+
var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
|
216
|
+
return yiq < 128;
|
217
|
+
},
|
218
|
+
|
219
|
+
light: function () {
|
220
|
+
return !this.dark();
|
221
|
+
},
|
222
|
+
|
223
|
+
negate: function () {
|
224
|
+
var rgb = [];
|
225
|
+
for (var i = 0; i < 3; i++) {
|
226
|
+
rgb[i] = 255 - this.values.rgb[i];
|
227
|
+
}
|
228
|
+
this.setValues('rgb', rgb);
|
229
|
+
return this;
|
230
|
+
},
|
231
|
+
|
232
|
+
lighten: function (ratio) {
|
233
|
+
var hsl = this.values.hsl;
|
234
|
+
hsl[2] += hsl[2] * ratio;
|
235
|
+
this.setValues('hsl', hsl);
|
236
|
+
return this;
|
237
|
+
},
|
238
|
+
|
239
|
+
darken: function (ratio) {
|
240
|
+
var hsl = this.values.hsl;
|
241
|
+
hsl[2] -= hsl[2] * ratio;
|
242
|
+
this.setValues('hsl', hsl);
|
243
|
+
return this;
|
244
|
+
},
|
245
|
+
|
246
|
+
saturate: function (ratio) {
|
247
|
+
var hsl = this.values.hsl;
|
248
|
+
hsl[1] += hsl[1] * ratio;
|
249
|
+
this.setValues('hsl', hsl);
|
250
|
+
return this;
|
251
|
+
},
|
252
|
+
|
253
|
+
desaturate: function (ratio) {
|
254
|
+
var hsl = this.values.hsl;
|
255
|
+
hsl[1] -= hsl[1] * ratio;
|
256
|
+
this.setValues('hsl', hsl);
|
257
|
+
return this;
|
258
|
+
},
|
259
|
+
|
260
|
+
whiten: function (ratio) {
|
261
|
+
var hwb = this.values.hwb;
|
262
|
+
hwb[1] += hwb[1] * ratio;
|
263
|
+
this.setValues('hwb', hwb);
|
264
|
+
return this;
|
265
|
+
},
|
266
|
+
|
267
|
+
blacken: function (ratio) {
|
268
|
+
var hwb = this.values.hwb;
|
269
|
+
hwb[2] += hwb[2] * ratio;
|
270
|
+
this.setValues('hwb', hwb);
|
271
|
+
return this;
|
272
|
+
},
|
273
|
+
|
274
|
+
greyscale: function () {
|
275
|
+
var rgb = this.values.rgb;
|
276
|
+
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
|
277
|
+
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
278
|
+
this.setValues('rgb', [val, val, val]);
|
279
|
+
return this;
|
280
|
+
},
|
281
|
+
|
282
|
+
clearer: function (ratio) {
|
283
|
+
var alpha = this.values.alpha;
|
284
|
+
this.setValues('alpha', alpha - (alpha * ratio));
|
285
|
+
return this;
|
286
|
+
},
|
287
|
+
|
288
|
+
opaquer: function (ratio) {
|
289
|
+
var alpha = this.values.alpha;
|
290
|
+
this.setValues('alpha', alpha + (alpha * ratio));
|
291
|
+
return this;
|
292
|
+
},
|
293
|
+
|
294
|
+
rotate: function (degrees) {
|
295
|
+
var hsl = this.values.hsl;
|
296
|
+
var hue = (hsl[0] + degrees) % 360;
|
297
|
+
hsl[0] = hue < 0 ? 360 + hue : hue;
|
298
|
+
this.setValues('hsl', hsl);
|
299
|
+
return this;
|
300
|
+
},
|
301
|
+
|
302
|
+
/**
|
303
|
+
* Ported from sass implementation in C
|
304
|
+
* https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
|
305
|
+
*/
|
306
|
+
mix: function (mixinColor, weight) {
|
307
|
+
var color1 = this;
|
308
|
+
var color2 = mixinColor;
|
309
|
+
var p = weight === undefined ? 0.5 : weight;
|
310
|
+
|
311
|
+
var w = 2 * p - 1;
|
312
|
+
var a = color1.alpha() - color2.alpha();
|
313
|
+
|
314
|
+
var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
|
315
|
+
var w2 = 1 - w1;
|
316
|
+
|
317
|
+
return this
|
318
|
+
.rgb(
|
319
|
+
w1 * color1.red() + w2 * color2.red(),
|
320
|
+
w1 * color1.green() + w2 * color2.green(),
|
321
|
+
w1 * color1.blue() + w2 * color2.blue()
|
322
|
+
)
|
323
|
+
.alpha(color1.alpha() * p + color2.alpha() * (1 - p));
|
324
|
+
},
|
325
|
+
|
326
|
+
toJSON: function () {
|
327
|
+
return this.rgb();
|
328
|
+
},
|
329
|
+
|
330
|
+
clone: function () {
|
331
|
+
// NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,
|
332
|
+
// making the final build way to big to embed in Chart.js. So let's do it manually,
|
333
|
+
// assuming that values to clone are 1 dimension arrays containing only numbers,
|
334
|
+
// except 'alpha' which is a number.
|
335
|
+
var result = new Color();
|
336
|
+
var source = this.values;
|
337
|
+
var target = result.values;
|
338
|
+
var value, type;
|
339
|
+
|
340
|
+
for (var prop in source) {
|
341
|
+
if (source.hasOwnProperty(prop)) {
|
342
|
+
value = source[prop];
|
343
|
+
type = ({}).toString.call(value);
|
344
|
+
if (type === '[object Array]') {
|
345
|
+
target[prop] = value.slice(0);
|
346
|
+
} else if (type === '[object Number]') {
|
347
|
+
target[prop] = value;
|
348
|
+
} else {
|
349
|
+
console.error('unexpected color value:', value);
|
350
|
+
}
|
351
|
+
}
|
352
|
+
}
|
353
|
+
|
354
|
+
return result;
|
355
|
+
}
|
356
|
+
};
|
357
|
+
|
358
|
+
Color.prototype.spaces = {
|
359
|
+
rgb: ['red', 'green', 'blue'],
|
360
|
+
hsl: ['hue', 'saturation', 'lightness'],
|
361
|
+
hsv: ['hue', 'saturation', 'value'],
|
362
|
+
hwb: ['hue', 'whiteness', 'blackness'],
|
363
|
+
cmyk: ['cyan', 'magenta', 'yellow', 'black']
|
364
|
+
};
|
365
|
+
|
366
|
+
Color.prototype.maxes = {
|
367
|
+
rgb: [255, 255, 255],
|
368
|
+
hsl: [360, 100, 100],
|
369
|
+
hsv: [360, 100, 100],
|
370
|
+
hwb: [360, 100, 100],
|
371
|
+
cmyk: [100, 100, 100, 100]
|
372
|
+
};
|
373
|
+
|
374
|
+
Color.prototype.getValues = function (space) {
|
375
|
+
var values = this.values;
|
376
|
+
var vals = {};
|
377
|
+
|
378
|
+
for (var i = 0; i < space.length; i++) {
|
379
|
+
vals[space.charAt(i)] = values[space][i];
|
380
|
+
}
|
381
|
+
|
382
|
+
if (values.alpha !== 1) {
|
383
|
+
vals.a = values.alpha;
|
384
|
+
}
|
385
|
+
|
386
|
+
// {r: 255, g: 255, b: 255, a: 0.4}
|
387
|
+
return vals;
|
388
|
+
};
|
389
|
+
|
390
|
+
Color.prototype.setValues = function (space, vals) {
|
391
|
+
var values = this.values;
|
392
|
+
var spaces = this.spaces;
|
393
|
+
var maxes = this.maxes;
|
394
|
+
var alpha = 1;
|
395
|
+
var i;
|
396
|
+
|
397
|
+
this.valid = true;
|
398
|
+
|
399
|
+
if (space === 'alpha') {
|
400
|
+
alpha = vals;
|
401
|
+
} else if (vals.length) {
|
402
|
+
// [10, 10, 10]
|
403
|
+
values[space] = vals.slice(0, space.length);
|
404
|
+
alpha = vals[space.length];
|
405
|
+
} else if (vals[space.charAt(0)] !== undefined) {
|
406
|
+
// {r: 10, g: 10, b: 10}
|
407
|
+
for (i = 0; i < space.length; i++) {
|
408
|
+
values[space][i] = vals[space.charAt(i)];
|
409
|
+
}
|
410
|
+
|
411
|
+
alpha = vals.a;
|
412
|
+
} else if (vals[spaces[space][0]] !== undefined) {
|
413
|
+
// {red: 10, green: 10, blue: 10}
|
414
|
+
var chans = spaces[space];
|
415
|
+
|
416
|
+
for (i = 0; i < space.length; i++) {
|
417
|
+
values[space][i] = vals[chans[i]];
|
418
|
+
}
|
419
|
+
|
420
|
+
alpha = vals.alpha;
|
421
|
+
}
|
422
|
+
|
423
|
+
values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha)));
|
424
|
+
|
425
|
+
if (space === 'alpha') {
|
426
|
+
return false;
|
427
|
+
}
|
428
|
+
|
429
|
+
var capped;
|
430
|
+
|
431
|
+
// cap values of the space prior converting all values
|
432
|
+
for (i = 0; i < space.length; i++) {
|
433
|
+
capped = Math.max(0, Math.min(maxes[space][i], values[space][i]));
|
434
|
+
values[space][i] = Math.round(capped);
|
435
|
+
}
|
436
|
+
|
437
|
+
// convert to all the other color spaces
|
438
|
+
for (var sname in spaces) {
|
439
|
+
if (sname !== space) {
|
440
|
+
values[sname] = convert[space][sname](values[space]);
|
441
|
+
}
|
442
|
+
}
|
443
|
+
|
444
|
+
return true;
|
445
|
+
};
|
446
|
+
|
447
|
+
Color.prototype.setSpace = function (space, args) {
|
448
|
+
var vals = args[0];
|
449
|
+
|
450
|
+
if (vals === undefined) {
|
451
|
+
// color.rgb()
|
452
|
+
return this.getValues(space);
|
453
|
+
}
|
454
|
+
|
455
|
+
// color.rgb(10, 10, 10)
|
456
|
+
if (typeof vals === 'number') {
|
457
|
+
vals = Array.prototype.slice.call(args);
|
458
|
+
}
|
459
|
+
|
460
|
+
this.setValues(space, vals);
|
461
|
+
return this;
|
462
|
+
};
|
463
|
+
|
464
|
+
Color.prototype.setChannel = function (space, index, val) {
|
465
|
+
var svalues = this.values[space];
|
466
|
+
if (val === undefined) {
|
467
|
+
// color.red()
|
468
|
+
return svalues[index];
|
469
|
+
} else if (val === svalues[index]) {
|
470
|
+
// color.red(color.red())
|
471
|
+
return this;
|
472
|
+
}
|
473
|
+
|
474
|
+
// color.red(100)
|
475
|
+
svalues[index] = val;
|
476
|
+
this.setValues(space, svalues);
|
477
|
+
|
478
|
+
return this;
|
479
|
+
};
|
480
|
+
|
481
|
+
if (typeof window !== 'undefined') {
|
482
|
+
window.Color = Color;
|
483
|
+
}
|
484
|
+
|
485
|
+
module.exports = Color;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2011 Heather Arthur <fayearthur@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# color-convert [![Build Status](https://travis-ci.org/harthur/color-convert.svg?branch=master)](https://travis-ci.org/harthur/color-convert)
|
2
|
+
Color-convert is a color conversion library for JavaScript and node. It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, and CSS keywords:
|
3
|
+
|
4
|
+
```js
|
5
|
+
var converter = require("color-convert")();
|
6
|
+
|
7
|
+
converter.rgb(140, 200, 100).hsl() // [96, 48, 59]
|
8
|
+
|
9
|
+
converter.keyword("blue").rgb() // [0, 0, 255]
|
10
|
+
```
|
11
|
+
|
12
|
+
# Install
|
13
|
+
|
14
|
+
```console
|
15
|
+
npm install color-convert
|
16
|
+
```
|
17
|
+
|
18
|
+
# API
|
19
|
+
|
20
|
+
Color-convert exports a converter object with getter/setter methods for each color space. It caches conversions:
|
21
|
+
|
22
|
+
```js
|
23
|
+
var converter = require("color-convert")();
|
24
|
+
|
25
|
+
converter.rgb(140, 200, 100).hsl() // [96, 48, 59]
|
26
|
+
|
27
|
+
converter.rgb([140, 200, 100]) // args can be an array
|
28
|
+
```
|
29
|
+
|
30
|
+
### Plain functions
|
31
|
+
Get direct conversion functions with no fancy objects:
|
32
|
+
|
33
|
+
```js
|
34
|
+
require("color-convert").rgb2hsl([140, 200, 100]); // [96, 48, 59]
|
35
|
+
```
|
36
|
+
|
37
|
+
### Unrounded
|
38
|
+
To get the unrounded conversion, append `Raw` to the function name:
|
39
|
+
|
40
|
+
```js
|
41
|
+
convert.rgb2hslRaw([140, 200, 100]); // [95.99999999999999, 47.619047619047606, 58.82352941176471]
|
42
|
+
```
|
43
|
+
|
44
|
+
### Hash
|
45
|
+
There's also a hash of the conversion functions keyed first by the "from" color space, then by the "to" color space:
|
46
|
+
|
47
|
+
```js
|
48
|
+
convert["hsl"]["hsv"]([160, 0, 20]) == convert.hsl2hsv([160, 0, 20])
|
49
|
+
```
|
50
|
+
|
51
|
+
### Other spaces
|
52
|
+
|
53
|
+
There are some conversions from rgb (sRGB) to XYZ and LAB too, available as `rgb2xyz()`, `rgb2lab()`, `xyz2rgb()`, and `xyz2lab()`.
|
54
|
+
|
55
|
+
# Contribute
|
56
|
+
|
57
|
+
Please fork, add conversions, figure out color profile stuff for XYZ, LAB, etc. This is meant to be a basic library that can be used by other libraries to wrap color calculations in some cool way.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
{
|
2
|
+
"name": "color-convert",
|
3
|
+
"description": "Plain color conversion functions",
|
4
|
+
"version": "0.5.3",
|
5
|
+
"author": "Heather Arthur <fayearthur@gmail.com>",
|
6
|
+
"repository": "harthur/color-convert",
|
7
|
+
"keywords": ["color", "colour", "rgb"],
|
8
|
+
"scripts": ["index.js", "conversions.js"]
|
9
|
+
}
|