/** * @param SS_HTTPRequest $request */ public function run($request) { echo 'Syncing identities to sass file:'; $colors = Identity::get_colors(); $str = ''; echo '<ul>'; foreach ($colors as $name => $c) { $str .= '$identity-color-' . $name . ': ' . $c . ';' . "\n"; echo "<li><em>{$name}:</em> <strong>{$c}</strong></li>"; } echo '</ul>'; echo 'Sync done.'; $base = str_replace('/public', '', Director::baseFolder()); //TODO this one should be configurable $file = "{$base}/resources/sass/_identity_synced.scss"; file_put_contents($file, $str); }
/** * Gradient overlay * Based on identity colors - you need to have set primary-gradient-start and primary-gradient-end in order to use this * @return string */ public function getBackgroundGradientCSS() { $colors = Identity::get_colors('rgb'); return "linear-gradient(" . $this->config()->gradient_direction . ',' . "rgba({$colors['primary-gradient-start']}, " . $this->config()->gradient_start_opacity . ")," . "rgba({$colors['primary-gradient-end']}, " . $this->config()->gradient_end_opacity . ")" . ")"; }