Example #1
0
 /**
  * Render a pattern and theme pair.
  *
  * @param  Raincolor\Containers\Pattern $pattern
  * @param  Raincolor\Containers\Pattern $theme
  * @return void
  */
 protected function render($pattern, $theme)
 {
     // Get template array from pattern.
     $templates = $pattern->get('templates');
     foreach ($templates as $template) {
         // Get the path to the pattern.
         $path = dirname($pattern->get('path'));
         // Load the template file from disk.
         $source = $this->file->load($path . '/' . $template->get('file'));
         // Create a new presenter.
         $presenter = new Presenter($source, $theme);
         // Get the resulting colour scheme.
         $scheme = $presenter->present();
         // Build the file output path for the scheme.
         $output = $this->buildOutputPath($pattern, $template, $theme);
         // Write the file to disk.
         $this->file->write($output, $scheme);
         // Update progress.
         $this->progress->advance();
     }
 }
Example #2
0
 /**
  * Load container data from JSON file.
  *
  * @param  string $path
  * @return void
  */
 public function fromFile($path)
 {
     $file = new File();
     $this->setData($file->loadJson($path));
 }