Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

Commit

Permalink
#149 add colour hex to color pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Joyce committed Nov 25, 2016
1 parent a35bc54 commit 1b4c0dc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pattern/branding/color/color.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
$lines = explode("\n", $css_contents);
$hasHeading = false;
$previous_group = 'x';

$matches = array();
preg_match_all('/\.u-fill-.*\n.*(#[0-9a-fA-F]+)/', $css_contents, $matches);

$cnt = 0;

foreach($lines as $line) {

if(substr(trim($line), 0, 7) == '.u-fill') {
$bits = explode(" ", substr($line, 1));
$class_ = str_replace(',','', $bits[0]);
Expand All @@ -32,12 +38,14 @@
<div class="u-block-xl <?php echo $class_ ?>">
</div>
<div class="card__footer">
<small><?php echo str_replace('-', ' ', str_replace('u-fill-', '', $class_)); ?></small>
<small><?php echo str_replace('-', ' ', str_replace('u-fill-', '', $class_)); ?> - <?php echo $matches[1][$cnt]; ?></small>
</div>
</div>
</div>
<?php
$cnt++;
}

}
?>
</div> <!-- close the last cc-vars div -->

0 comments on commit 1b4c0dc

Please sign in to comment.