From 6344be35a393bc0d131e1489669198b865f1762d Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 23 Oct 2014 13:27:20 +1100 Subject: [PATCH] Dynamic colors in tables and fix #67 --- assets/css/sportspress.css | 9 +++++++-- includes/class-sp-frontend-scripts.php | 14 ++++++++++---- includes/sp-formatting-functions.php | 26 +++++++++++++++++--------- templates/league-table.php | 17 +++++++---------- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index 931734ec..977ab172 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -242,11 +242,16 @@ /* Alternate */ .sp-data-table tbody tr.odd, -.sp-data-table tbody tr.alternate, -.sp-calendar tbody td#today { +.sp-data-table tbody tr.alternate { background: rgba(0, 0, 0, 0.02); } +/* Highlight */ +.sp-highlight { + background: #fff; + font-weight: bold; +} + @media only screen and (max-width: 40em) { .sp-responsive-table { margin-bottom: 0; diff --git a/includes/class-sp-frontend-scripts.php b/includes/class-sp-frontend-scripts.php index b1aff60e..d3bdc8bc 100644 --- a/includes/class-sp-frontend-scripts.php +++ b/includes/class-sp-frontend-scripts.php @@ -153,10 +153,13 @@ class SP_Frontend_Scripts { // Defaults if ( empty( $colors['primary'] ) ) $colors['primary'] = '#00a69c'; if ( empty( $colors['background'] ) ) $colors['background'] = '#f4f4f4'; - if ( empty( $colors['highlight'] ) ) $colors['highlight'] = '#ffffff'; if ( empty( $colors['text'] ) ) $colors['text'] = '#363f48'; if ( empty( $colors['heading'] ) ) $colors['heading'] = '#ffffff'; if ( empty( $colors['link'] ) ) $colors['link'] = '#00a69c'; + + // Calculate colors + $colors['highlight'] = sp_hex_lighter( $colors['background'], 30, true ); + $colors['lowlight'] = sp_hex_darker( $colors['background'], 8, true ); echo '