Skip to content

Commit 1d68722

Browse files
authored
fix: Add Weekdays, Correct Font Color (#4836)
1 parent 961572f commit 1d68722

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

app/helpers/is-light.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { isLight } from 'open-event-frontend/utils/color';
2+
import Helper from '@ember/component/helper';
3+
4+
export function textColor(color) {
5+
return isLight(color) ? '#000' : '#fff';
6+
}
7+
export default Helper.helper(textColor);

app/templates/components/public/speaker-item.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
<p>
4949
{{#if session.startsAt}}
5050
<strong>
51-
{{moment-format session.startsAt 'DD MMM YY'}}
51+
{{general-date session.startsAt session.event.timezone}}
5252
</strong>
5353
{{/if}}
5454
</p>
5555
<a href="{{href-to 'public.sessions.list' 'all'}}#session-id-{{session.id}}">
5656
<div class="ui fluid padded" style={{css color=session.track.fontColor background-color=session.track.color}}>
57-
<h3 class="item" style={{css user-select='text'}}>
57+
<h3 class="item" style={{css user-select='text' color=(is-light session.track.color)}}>
5858
{{#if (and session.startsAt session.endsAt)}}
5959
{{moment-format session.startsAt 'HH:mm'}} - {{moment-format session.endsAt 'hh:mm'}}
6060
<br>

app/utils/color.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export function getLuma(hex: string): number {
22
// https://stackoverflow.com/a/12043228/3309666
3-
const c = hex.substring(1); // strip #
3+
const c = hex.toString().substring(1); // strip #
44
const rgb = parseInt(c, 16); // convert rrggbb to decimal
55
const r = (rgb >> 16) & 0xff; // extract red
66
const g = (rgb >> 8) & 0xff; // extract green

0 commit comments

Comments
 (0)