add hsl
This commit is contained in:
parent
c851bdca4d
commit
0530520cd2
2 changed files with 16 additions and 0 deletions
|
@ -1,5 +1,14 @@
|
|||
{% extends "base.html" %}
|
||||
{% block main %}
|
||||
<style>
|
||||
:root {
|
||||
--film-color: {{ film.color }};
|
||||
}
|
||||
body {
|
||||
background: var(--film-color);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="film">
|
||||
<div class="info">
|
||||
|
|
|
@ -37,10 +37,17 @@ class Film(models.Model):
|
|||
def duration(self):
|
||||
return ox.format_timecode(self.data['duration'])[:-4]
|
||||
|
||||
def color(self):
|
||||
hue = self.data['hue']
|
||||
saturation = self.data['saturation'] * 100
|
||||
saturation = 70
|
||||
lightness = self.data['lightness'] * 100
|
||||
return "hsl({}, {}%, {}%)".format(hue, saturation, lightness)
|
||||
|
||||
def json(self):
|
||||
data = {}
|
||||
data['id'] = self.padma_id
|
||||
#data.update(self.data)
|
||||
return json.dumps(data)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue