mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Merge branch 'krophil' into 'master'
Add color palette creator + add list of refillings See merge request !105
This commit is contained in:
commit
e581de0a94
@ -18,7 +18,8 @@
|
||||
<a href="{{ url('counter:stats', counter_id=c.id) }}">{% trans %}Stats{% endtrans %}</a> -
|
||||
{% endif %}
|
||||
{% if user.is_owner(c) %}
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a>
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a> -
|
||||
<a href="{{ url('counter:refilling_list', counter_id=c.id) }}">{% trans %}Refillings list{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
@ -39,7 +40,8 @@
|
||||
<a href="{{url('stock:new', counter_id=c.id)}}">{% trans %}Create new stock{% endtrans%}</a> -
|
||||
{% endif %}
|
||||
{% if user.is_owner(c) %}
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a>
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a> -
|
||||
<a href="{{ url('counter:refilling_list', counter_id=c.id) }}">{% trans %}Refillings list{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
33
counter/templates/counter/refilling_list.jinja
Normal file
33
counter/templates/counter/refilling_list.jinja
Normal file
@ -0,0 +1,33 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import paginate %}
|
||||
|
||||
{% block title %}
|
||||
{%- trans %}Refillings list{% endtrans %} -- {{ counter.name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans %}Refilling{% endtrans %}</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>{% trans %}Customer{% endtrans %}</th>
|
||||
<th>{% trans %}Amount{% endtrans %}</th>
|
||||
<th>{% trans %}Payment method{% endtrans %}</th>
|
||||
<th>{% trans %}Seller{% endtrans %}</th>
|
||||
<th>{% trans %}Actions{% endtrans %}</th>
|
||||
</tr>
|
||||
{%- for refilling in object_list %}
|
||||
<tr>
|
||||
<td><a href="{{ url('core:user_profile', user_id=refilling.customer.user.id) }}">{{ refilling.customer }}</a></td>
|
||||
<td>{{ refilling.amount }}</td>
|
||||
<td>{{ refilling.payment_method }}</td>
|
||||
<td>{{ refilling.operator }}</td>
|
||||
<td><a href="{{ url('counter:refilling_delete', refilling_id=refilling.id)}}">Delete</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{%- endfor %}
|
||||
{% if is_paginated %}
|
||||
{{ paginate(page_obj, paginator) }}
|
||||
{% endif %}
|
||||
{%- endblock %}
|
||||
|
@ -56,6 +56,8 @@ urlpatterns = [
|
||||
url(r'^admin/eticket/(?P<eticket_id>[0-9]+)$', EticketEditView.as_view(), name='edit_eticket'),
|
||||
url(r'^admin/selling/(?P<selling_id>[0-9]+)/delete$', SellingDeleteView.as_view(), name='selling_delete'),
|
||||
url(r'^admin/refilling/(?P<refilling_id>[0-9]+)/delete$', RefillingDeleteView.as_view(), name='refilling_delete'),
|
||||
url(r'^admin/(?P<counter_id>[0-9]+)/refillings$', CounterRefillingListView.as_view(), name='refilling_list'),
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -1280,3 +1280,23 @@ class EticketPDFView(CanViewMixin, DetailView):
|
||||
p.showPage()
|
||||
p.save()
|
||||
return response
|
||||
|
||||
|
||||
class CounterRefillingListView(CounterAdminTabsMixin, CounterAdminMixin, ListView):
|
||||
"""
|
||||
List of refillings on a counter
|
||||
"""
|
||||
model = Refilling
|
||||
template_name = 'counter/refilling_list.jinja'
|
||||
current_tab = "counters"
|
||||
paginate_by = 30
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
self.counter = get_object_or_404(Counter, pk=kwargs['counter_id'])
|
||||
self.queryset = Refilling.objects.filter(counter__id=self.counter.id)
|
||||
return super(CounterRefillingListView, self).dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(CounterRefillingListView, self).get_context_data(**kwargs)
|
||||
kwargs['counter'] = self.counter
|
||||
return kwargs
|
||||
|
3
doc/Color Theory - Palette Creator/README.txt
Normal file
3
doc/Color Theory - Palette Creator/README.txt
Normal file
@ -0,0 +1,3 @@
|
||||
A Pen created at CodePen.io. You can find this one at https://codepen.io/anon/pen/PKVVXY.
|
||||
|
||||
This page was used to generate the color palette of the sith.
|
74
doc/Color Theory - Palette Creator/css/style.css
Normal file
74
doc/Color Theory - Palette Creator/css/style.css
Normal file
@ -0,0 +1,74 @@
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #424242;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-size: .875rem;
|
||||
}
|
||||
|
||||
.form {
|
||||
margin: 5rem 0;
|
||||
width: 30rem;
|
||||
background: #FAFAFA;
|
||||
padding: 2rem;
|
||||
border-radius: .25rem;
|
||||
box-shadow: 0 4px 5px hsla(0, 0%, 0%, .5);
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
}
|
||||
|
||||
.form-group:not(:first-child) {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.color-display {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.color-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.color-group > .color-code {
|
||||
flex: 1 0 auto;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
.color-hue {
|
||||
height: 2rem;
|
||||
align-self: stretch;
|
||||
background-image: linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.color-preview {
|
||||
height: 5rem;
|
||||
width: 5rem;
|
||||
background-color: lightgrey;
|
||||
border: 1px solid black;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.color-text {
|
||||
font-size: 3rem;
|
||||
}
|
422
doc/Color Theory - Palette Creator/index.html
Normal file
422
doc/Color Theory - Palette Creator/index.html
Normal file
@ -0,0 +1,422 @@
|
||||
<!DOCTYPE html>
|
||||
<html >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Color Theory Palette creator</title>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
/* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #424242;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-size: .875rem;
|
||||
}
|
||||
|
||||
.form {
|
||||
margin: 5rem 0;
|
||||
width: 30rem;
|
||||
background: #FAFAFA;
|
||||
padding: 2rem;
|
||||
border-radius: .25rem;
|
||||
box-shadow: 0 4px 5px hsla(0, 0%, 0%, .5);
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
}
|
||||
|
||||
.form-group:not(:first-child) {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.color-display {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.color-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.color-group > .color-code {
|
||||
flex: 1 0 auto;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
.color-hue {
|
||||
height: 2rem;
|
||||
align-self: stretch;
|
||||
background-image: linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.color-preview {
|
||||
height: 5rem;
|
||||
width: 5rem;
|
||||
background-color: lightgrey;
|
||||
border: 1px solid black;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.color-text {
|
||||
font-size: 3rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form name="color-theory" class="form">
|
||||
<div class="form-group">
|
||||
<div class="color-hue"></div>
|
||||
<input type="range" name="first-color" class="form-input" min="0" max="359" value="220">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<fieldset class="first-color">
|
||||
<legend>First color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview"></div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="second-color">
|
||||
<legend>Second color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview"></div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<fieldset class="primary-color">
|
||||
<legend>Primary color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview"></div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="complementary-color">
|
||||
<legend>Secondary color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview"></div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<fieldset class="text-on-primary">
|
||||
<legend>Text on primary color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="text-on-complementary">
|
||||
<legend>Text on complementary color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<fieldset class="complementary-neutral-light">
|
||||
<legend>Complementary neutral light color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="complementary-neutral">
|
||||
<legend>Complementary neutral color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="complementary-neutral-dark">
|
||||
<legend>Complementary neutral dark color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="primary-neutral-light">
|
||||
<legend>Primary neutral light color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="primary-neutral">
|
||||
<legend>Primary neutral color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="primary-neutral-dark">
|
||||
<legend>Primary neutral dark color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<fieldset class="white">
|
||||
<legend>"White" color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="black">
|
||||
<legend>"Black" color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<fieldset class="primary-light">
|
||||
<legend>Primary light color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="primary-color">
|
||||
<legend>Primary color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="primary-dark">
|
||||
<legend>Primary dark color</legend>
|
||||
<div class="color-group">
|
||||
<div class="color-preview">
|
||||
<span class="color-text">Ab</span>
|
||||
</div>
|
||||
<input type="text" class="color-code" readonly>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
<template id="scss-template">
|
||||
<style type="text/scss">
|
||||
//From https://github.com/tallys/color-theory
|
||||
|
||||
//Pick a color
|
||||
|
||||
// THIS IS SET IN THE THEME FILE AT THE TOP LEVEL
|
||||
// $first-color: hsl(17, 100%, 50%);
|
||||
|
||||
// Find the complement
|
||||
|
||||
$second-color: complement($first-color);
|
||||
|
||||
//Check if you have a cool color on your hands. Cool colors will overpower warm colors when mixing.
|
||||
|
||||
@function is-cool-color($color) {
|
||||
@return hue($color) < 310 and hue($color) > 140;
|
||||
}
|
||||
|
||||
@function is-high-key-value($color) {
|
||||
@return hue($color) > 20 and hue($color) < 190;
|
||||
}
|
||||
|
||||
@function is-highest-key-value($color) {
|
||||
@return hue($color) > 30 and hue($color) <90;
|
||||
}
|
||||
|
||||
//Establish a relationship (similar lighting conditions) between colors.
|
||||
|
||||
@function harmonious-mix($mix, $base) {
|
||||
@if (is-cool-color($mix)){
|
||||
@if is-high-key-value($base) {
|
||||
@return mix($mix, $base, 11%);
|
||||
}
|
||||
@else {
|
||||
@return mix($mix, $base, 16%);
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@if is-high-key-value($base) {
|
||||
@return mix($mix, $base, 13%);
|
||||
}
|
||||
@else {
|
||||
@return mix($mix, $base, 23%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@function mix-neutral($color) {
|
||||
@if (is-highest-key-value($color)) {
|
||||
@if is-high-key-value(complement($color)) {
|
||||
@return mix(complement($color), $color, 19%);
|
||||
}
|
||||
@else {
|
||||
@return mix(complement($color), $color, 13%);
|
||||
}
|
||||
}
|
||||
@else if (is-high-key-value($color)) {
|
||||
@if is-high-key-value(complement($color)) {
|
||||
@return mix(complement($color), $color, 31%);
|
||||
}
|
||||
@else {
|
||||
@return mix(complement($color), $color, 23%);
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@if is-highest-key-value(complement($color)) {
|
||||
@return mix(complement($color), $color, 31%);
|
||||
}
|
||||
@if is-high-key-value(complement($color)) {
|
||||
@return mix(complement($color), $color, 26%);
|
||||
}
|
||||
@else {
|
||||
@return mix(complement($color), $color, 23%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@function pick-contrast-of($color) {
|
||||
@if is-high-key-value($color){
|
||||
@if lightness($color) < 30% {
|
||||
@return lighten(complement($color), 86);
|
||||
}
|
||||
@else if lightness($color) > 70% {
|
||||
@return darken(complement($color), 68);
|
||||
}
|
||||
@else {
|
||||
@return darken(complement($color), 53);
|
||||
}
|
||||
} @else {
|
||||
@if lightness($color) < 30% {
|
||||
@return lighten(complement($color), 86);
|
||||
}
|
||||
@else if lightness($color) > 70% {
|
||||
@return darken(complement($color), 68);
|
||||
}
|
||||
@else {
|
||||
@return lighten(complement($color), 53);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$primary-color: harmonious-mix($second-color, $first-color);
|
||||
$complementary-color: harmonious-mix($first-color, $second-color);
|
||||
|
||||
// Complementary Neutrals, highlight, midtone, shadow
|
||||
|
||||
$complementary-neutral: mix-neutral($complementary-color);
|
||||
$complementary-neutral-light: lighten($complementary-neutral, 33);
|
||||
$complementary-neutral-dark: darken($complementary-neutral, 33);
|
||||
|
||||
// Primary neutrals, highlight, midtone, shadow`
|
||||
|
||||
$primary-neutral: mix-neutral($primary-color);
|
||||
$primary-neutral-light: lighten($primary-neutral, 33);
|
||||
$primary-neutral-dark: darken($primary-neutral, 33);
|
||||
|
||||
// Primary tint and shade
|
||||
|
||||
$primary-light: mix($primary-neutral-light, $primary-color, 45%);
|
||||
$primary-dark: mix($primary-neutral-dark, $primary-color, 45%);
|
||||
|
||||
$complementary-light: mix($complementary-neutral-light, $complementary-color, 45%);
|
||||
|
||||
// Pure neutrals, highlight, midtone, shadow
|
||||
|
||||
$white: lighten($primary-neutral-light, 15);
|
||||
$neutral-gray: grayscale($primary-neutral);
|
||||
$primary-gray: mix($primary-color, $complementary-color, 30);
|
||||
$complementary-gray: mix($complementary-color, $primary-color, 63);
|
||||
$black: grayscale($complementary-neutral-dark);
|
||||
|
||||
// Analogous Colors
|
||||
|
||||
$analogous-color: adjust-hue($complementary-color, -40);
|
||||
$complementary-analogous: mix($analogous-color, $complementary-color, 66);
|
||||
|
||||
.first-color {color: unquote( 'hsl(') hue($first-color), saturation($first-color), lightness($first-color) unquote(')')}
|
||||
.second-color {color: unquote( 'hsl(') hue($second-color), saturation($second-color), lightness($second-color) unquote(')')}
|
||||
|
||||
.primary-color {color: unquote( 'hsl(') hue($primary-color), saturation($primary-color), lightness($primary-color) unquote(')')}
|
||||
.complementary-color {color: unquote( 'hsl(') hue($complementary-color), saturation($complementary-color), lightness($complementary-color) unquote(')')}
|
||||
|
||||
.primary-neutral-light {color: unquote( 'hsl(') hue($primary-neutral-light), saturation($primary-neutral-light), lightness($primary-neutral-light) unquote(')')}
|
||||
.primary-neutral {color: unquote( 'hsl(') hue($primary-neutral), saturation($primary-neutral), lightness($primary-neutral) unquote(')')}
|
||||
.primary-neutral-dark {color: unquote( 'hsl(') hue($primary-neutral-dark), saturation($primary-neutral-dark), lightness($primary-neutral-dark) unquote(')')}
|
||||
.complementary-neutral-light {color: unquote( 'hsl(') hue($complementary-neutral-light), saturation($complementary-neutral-light), lightness($complementary-neutral-light) unquote(')')}
|
||||
.complementary-neutral {color: unquote( 'hsl(') hue($complementary-neutral), saturation($complementary-neutral), lightness($complementary-neutral) unquote(')')}
|
||||
.complementary-neutral-dark {color: unquote( 'hsl(') hue($complementary-neutral-dark), saturation($complementary-neutral-dark), lightness($complementary-neutral-dark) unquote(')')}
|
||||
|
||||
.white {color: unquote( 'hsl(') hue($white), saturation($white), lightness($white) unquote(')')}
|
||||
.black {color: unquote( 'hsl(') hue($black), saturation($black), lightness($black) unquote(')')}
|
||||
|
||||
.primary-light {color: unquote( 'hsl(') hue($primary-light), saturation($primary-light), lightness($primary-light) unquote(')')}
|
||||
.primary-dark {color: unquote( 'hsl(') hue($primary-dark), saturation($primary-dark), lightness($primary-dark) unquote(')')}
|
||||
|
||||
.complementary-light {color: unquote( 'hsl(') hue($complementary-light), saturation($complementary-light), lightness($complementary-light) unquote(')')}
|
||||
.primary-gray {color: unquote( 'hsl(') hue($primary-gray), saturation($primary-gray), lightness($primary-gray) unquote(')')}
|
||||
.neutral-gray {color: unquote( 'hsl(') hue($neutral-gray), saturation($neutral-gray), lightness($neutral-gray) unquote(')')}
|
||||
.complementary-gray {color: unquote( 'hsl(') hue($complementary-gray), saturation($complementary-gray), lightness($complementary-gray) unquote(')')}
|
||||
</style>
|
||||
</template>
|
||||
<script src='https://cdnjs.cloudflare.com/ajax/libs/sass.js/0.10.3/sass.sync.js'></script>
|
||||
|
||||
<script src="js/index.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
103
doc/Color Theory - Palette Creator/js/index.js
Normal file
103
doc/Color Theory - Palette Creator/js/index.js
Normal file
@ -0,0 +1,103 @@
|
||||
/* jshint esversion: 6 */
|
||||
|
||||
// This is using Sass.js to use Sass built-in color mixing functions
|
||||
|
||||
const firstColorChooser = document.forms['color-theory']['first-color'];
|
||||
const firstColor = document.querySelector('.first-color');
|
||||
const secondColor = document.querySelector('.second-color');
|
||||
|
||||
let hue = undefined;
|
||||
let comp = undefined;
|
||||
|
||||
updateColors();
|
||||
Sass.options({
|
||||
precision: 1
|
||||
});
|
||||
computeScss();
|
||||
|
||||
document.forms['color-theory']['first-color'].addEventListener('input', updateColors);
|
||||
|
||||
document.forms['color-theory']['first-color'].addEventListener('change', computeScss);
|
||||
|
||||
function updateColors(ev) {
|
||||
hue = parseInt(firstColorChooser.value);
|
||||
comp = (hue + 180) % 360;
|
||||
setColorPreview([firstColor], `hsl(${hue}, 100%, 50%)`);
|
||||
setColorPreview([secondColor], `hsl(${comp}, 100%, 50%)`);
|
||||
}
|
||||
|
||||
function setColorPreview(fieldsets, color) {
|
||||
Array.from(fieldsets).forEach(fieldset => {
|
||||
const preview = fieldset.querySelector('.color-preview');
|
||||
preview.style.backgroundColor = fieldset.querySelector('.color-code').value = color;
|
||||
const text = fieldset.querySelector('.color-text')
|
||||
if(text)
|
||||
text.style.color = computeTextColor(window.getComputedStyle(preview).backgroundColor);
|
||||
});
|
||||
}
|
||||
|
||||
function setColorText(fieldsets, bg, text) {
|
||||
Array.from(fieldsets).forEach(fieldset => {
|
||||
fieldset.querySelector('.color-preview').style.backgroundColor = bg;
|
||||
fieldset.querySelector('.color-text').style.color = fieldset.querySelector('.color-code').value = text;
|
||||
});
|
||||
}
|
||||
|
||||
function computeScss() {
|
||||
Sass.compile(
|
||||
`$first-color: hsl(${hue}, 100%, 50%);` +
|
||||
document.querySelector('#scss-template').content.firstElementChild.textContent, computedScssHandler);
|
||||
|
||||
}
|
||||
|
||||
function computedScssHandler(result) {
|
||||
let colors = {};
|
||||
result.text.split('\n\n').forEach(rule => {
|
||||
const color = /\.([\w\-]+) {\s*color: (hsl\() (\d{1,3}(?:\.\d+)?)deg(.*) (\));\s*}/.exec(rule).splice(1, 5).join('').split('hsl');
|
||||
colors[color[0]] = `hsl${color[1]}`;
|
||||
});
|
||||
|
||||
for (let colorName in colors)
|
||||
if (document.querySelector(`.${colorName}`)) setColorPreview(document.querySelectorAll(`.${colorName}`), colors[colorName]);
|
||||
|
||||
const primaryTextColor = computeTextColor(window.getComputedStyle(document.querySelector('.primary-color .color-preview')).backgroundColor);
|
||||
const complementaryTextColor = computeTextColor(window.getComputedStyle(document.querySelector('.complementary-color .color-preview')).backgroundColor);
|
||||
setColorText([document.querySelector('.text-on-primary')], document.querySelector('.primary-color .color-preview').style.backgroundColor, primaryTextColor);
|
||||
setColorText([document.querySelector('.text-on-complementary')], document.querySelector('.complementary-color .color-preview').style.backgroundColor, complementaryTextColor)
|
||||
}
|
||||
|
||||
function computeTextColor(colorStr) {
|
||||
const black = [0, 0, 0, .87];
|
||||
const white = [255, 255, 255, 1];
|
||||
|
||||
[, , r, g, b, a] = /(rgba?)\((\d{1,3}), (\d{1,3}), (\d{1,3})(?:, (\d(?:\.\d+)))?\)/.exec(colorStr);
|
||||
const color = [parseInt(r), parseInt(g), parseInt(b), parseFloat(a == undefined ? 1 : a)]
|
||||
const blackContrast = computeConstrastRatio(black, color);
|
||||
const whiteContrast = computeConstrastRatio(white, color);
|
||||
return blackContrast < whiteContrast ? `hsl(0, 0%, 100%)` : `hsla(0, 0%, 0%, 0.87)`
|
||||
}
|
||||
|
||||
function computeConstrastRatio([fr, fg, fb, fa], [br, bg, bb, ba]) {
|
||||
if (fa < 1) {
|
||||
fr = fr * fa + br * (1 - fa);
|
||||
fg = fg * fa + bg * (1 - fa);
|
||||
fb = fb * fa + bb * (1 - fa);
|
||||
fa = 1;
|
||||
}
|
||||
const fl = luminance([fr, fg, fb]);
|
||||
const bl = luminance([br, bg, bb]);
|
||||
|
||||
if (fl < bl)
|
||||
return (bl + .05) / (fl + .05);
|
||||
else
|
||||
return (fl + .05) / (bl + .05);
|
||||
}
|
||||
|
||||
function luminance([r, g, b]) {
|
||||
return .2126 * colorComponent(r) + .7152 * colorComponent(g) + .0722 * colorComponent(b);
|
||||
}
|
||||
|
||||
function colorComponent(color) {
|
||||
const c = color / 255;
|
||||
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
||||
}
|
16
doc/Color Theory - Palette Creator/license.txt
Normal file
16
doc/Color Theory - Palette Creator/license.txt
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
<!--
|
||||
Copyright (c) 2017 by Captain Anonymous (https://codepen.io/anon/pen/PKVVXY)
|
||||
|
||||
|
||||
Fork of an original work by Jean-Baptiste Lenglet (https://codepen.io/Magador/pen/YZjWxe)
|
||||
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
-->
|
@ -6,7 +6,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-09-02 12:33+0200\n"
|
||||
"POT-Creation-Date: 2017-09-02 15:17+0200\n"
|
||||
"PO-Revision-Date: 2016-07-18\n"
|
||||
"Last-Translator: Skia <skia@libskia.so>\n"
|
||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||
@ -404,8 +404,8 @@ msgstr "Nouveau compte club"
|
||||
#: core/templates/core/user_tools.jinja:41 core/views/user.py:186
|
||||
#: counter/templates/counter/cash_summary_list.jinja:53
|
||||
#: counter/templates/counter/counter_list.jinja:17
|
||||
#: counter/templates/counter/counter_list.jinja:32
|
||||
#: counter/templates/counter/counter_list.jinja:53
|
||||
#: counter/templates/counter/counter_list.jinja:33
|
||||
#: counter/templates/counter/counter_list.jinja:55
|
||||
#: election/templates/election/election_detail.jinja:279
|
||||
#: election/templates/election/election_detail.jinja:327
|
||||
#: election/templates/election/election_detail.jinja:375
|
||||
@ -494,6 +494,7 @@ msgstr "Fin"
|
||||
#: core/templates/core/user_account_detail.jinja:53
|
||||
#: core/templates/core/user_account_detail.jinja:80
|
||||
#: counter/templates/counter/last_ops.jinja:17
|
||||
#: counter/templates/counter/refilling_list.jinja:13
|
||||
msgid "Amount"
|
||||
msgstr "Montant"
|
||||
|
||||
@ -517,6 +518,7 @@ msgstr "Fermé"
|
||||
#: com/templates/com/news_admin_list.jinja:242
|
||||
#: com/templates/com/news_admin_list.jinja:276
|
||||
#: com/templates/com/weekmail.jinja:21 com/templates/com/weekmail.jinja:50
|
||||
#: counter/templates/counter/refilling_list.jinja:16
|
||||
msgid "Actions"
|
||||
msgstr "Actions"
|
||||
|
||||
@ -1062,6 +1064,7 @@ msgstr "Barman"
|
||||
#: counter/templates/counter/counter_click.jinja:29
|
||||
#: counter/templates/counter/last_ops.jinja:16
|
||||
#: counter/templates/counter/last_ops.jinja:41
|
||||
#: counter/templates/counter/refilling_list.jinja:12
|
||||
msgid "Customer"
|
||||
msgstr "Client"
|
||||
|
||||
@ -1088,6 +1091,7 @@ msgstr "Total"
|
||||
#: core/templates/core/user_account_detail.jinja:54
|
||||
#: counter/templates/counter/last_ops.jinja:18
|
||||
#: counter/templates/counter/last_ops.jinja:45
|
||||
#: counter/templates/counter/refilling_list.jinja:14
|
||||
msgid "Payment method"
|
||||
msgstr "Méthode de paiement"
|
||||
|
||||
@ -1188,8 +1192,8 @@ msgid "Mailing list"
|
||||
msgstr "Listes de diffusion"
|
||||
|
||||
#: club/views.py:134 counter/templates/counter/counter_list.jinja:21
|
||||
#: counter/templates/counter/counter_list.jinja:42
|
||||
#: counter/templates/counter/counter_list.jinja:57
|
||||
#: counter/templates/counter/counter_list.jinja:43
|
||||
#: counter/templates/counter/counter_list.jinja:59
|
||||
msgid "Props"
|
||||
msgstr "Propriétés"
|
||||
|
||||
@ -2938,20 +2942,20 @@ msgstr "Appels à facture"
|
||||
|
||||
#: core/templates/core/user_tools.jinja:42 core/views/user.py:213
|
||||
#: counter/templates/counter/counter_list.jinja:18
|
||||
#: counter/templates/counter/counter_list.jinja:33
|
||||
#: counter/templates/counter/counter_list.jinja:54
|
||||
#: counter/templates/counter/counter_list.jinja:34
|
||||
#: counter/templates/counter/counter_list.jinja:56
|
||||
msgid "Stats"
|
||||
msgstr "Stats"
|
||||
|
||||
#: core/templates/core/user_tools.jinja:46
|
||||
#: counter/templates/counter/counter_list.jinja:37
|
||||
#: counter/templates/counter/counter_list.jinja:38
|
||||
#: stock/templates/stock/stock_item_list.jinja:11
|
||||
#: stock/templates/stock/stock_list.jinja:16
|
||||
msgid "Shopping lists"
|
||||
msgstr "Liste de courses"
|
||||
|
||||
#: core/templates/core/user_tools.jinja:48
|
||||
#: counter/templates/counter/counter_list.jinja:39
|
||||
#: counter/templates/counter/counter_list.jinja:40
|
||||
msgid "Create new stock"
|
||||
msgstr "Créer nouveau stock"
|
||||
|
||||
@ -3406,6 +3410,7 @@ msgid "Finish"
|
||||
msgstr "Terminer"
|
||||
|
||||
#: counter/templates/counter/counter_click.jinja:97
|
||||
#: counter/templates/counter/refilling_list.jinja:9
|
||||
msgid "Refilling"
|
||||
msgstr "Rechargement"
|
||||
|
||||
@ -3418,15 +3423,21 @@ msgstr "Liste des comptoirs"
|
||||
msgid "New counter"
|
||||
msgstr "Nouveau comptoir"
|
||||
|
||||
#: counter/templates/counter/counter_list.jinja:26
|
||||
#: counter/templates/counter/counter_list.jinja:22
|
||||
#: counter/templates/counter/counter_list.jinja:44
|
||||
#: counter/templates/counter/refilling_list.jinja:5
|
||||
msgid "Refillings list"
|
||||
msgstr "Liste de rechargements"
|
||||
|
||||
#: counter/templates/counter/counter_list.jinja:27
|
||||
msgid "Bars"
|
||||
msgstr "Bars"
|
||||
|
||||
#: counter/templates/counter/counter_list.jinja:47
|
||||
#: counter/templates/counter/counter_list.jinja:49
|
||||
msgid "Offices"
|
||||
msgstr "Bureaux"
|
||||
|
||||
#: counter/templates/counter/counter_list.jinja:63
|
||||
#: counter/templates/counter/counter_list.jinja:65
|
||||
msgid "There is no counters in this website."
|
||||
msgstr "Il n'y a pas de comptoirs dans ce site web."
|
||||
|
||||
@ -3527,6 +3538,10 @@ msgstr "Nouveau type de produit"
|
||||
msgid "There is no product types in this website."
|
||||
msgstr "Il n'y a pas de types de produit dans ce site web."
|
||||
|
||||
#: counter/templates/counter/refilling_list.jinja:15
|
||||
msgid "Seller"
|
||||
msgstr "Vendeur"
|
||||
|
||||
#: counter/templates/counter/stats.jinja:5
|
||||
#: counter/templates/counter/stats.jinja:9
|
||||
#, python-format
|
||||
|
Loading…
Reference in New Issue
Block a user