<commit_before>[![Travis](https://img.shields.io/travis/AnnotateFramework/themes.svg?style=flat-square)](https://travis-ci.org/AnnotateFramework/themes)
[![Code Climate](https://img.shields.io/codeclimate/github/AnnotateFramework/themes.svg?style=flat-square)](https://codeclimate.com/github/AnnotateFramework/themes)
[![Code Climate](https://img.shields.io/codeclimate/coverage/github/AnnotateFramework/themes.svg?style=flat-square)](https://codeclimate.com/github/AnnotateFramework/themes)


[![Packagist](https://img.shields.io/packagist/v/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)
[![Packagist](https://img.shields.io/packagist/dm/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)
[![Packagist](https://img.shields.io/packagist/dd/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)
[![Packagist](https://img.shields.io/packagist/dt/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)

Themes package for Annotate Framework
=====================================

This package provides powerfull themes support. You can create theme and override every template in theme.

Installation
------------

Require this extension by [Composer](http://getcomposer.org)

```sh
$ composer require annotate/themes:@dev
```

Register extension into configuration:

```yml
extensions:
    themes: Annotate\Themes\DI\ThemesExtension
```

Configure
---------

Default themes are set to `Sandbox` for frontend and `Flatty` for backend. Both are provided in sandbox package.
Themes path is also configurable via Neon. Default `directory` value is `%appDir%/app/addons/themes/`.
To change themes open app/config/app.neon and add following configuration:

    themes:
        directory: %appDir%/app/
        frontend: FrontendThemeName
        backend: BackendThemeName
    
Now edit any of your presenters:

    class FrontendPresenter extends BasePresenter
    {
        /** @var Annotate\Themes\Loaders\ThemesLoader @inject */
        public $themesLoader;
    
        public function startup()
        {
            parent::startup();
            $this->themesLoader->activateFrontendTheme(); // or activateBackendTheme()
        }
    }
    
Hint!
-----

For the best possible experience use annotate/packages package with annotate/themes
    
Uninstall
---------

Just remove line with `annotate/themes` from composer.json and run `composer update`

Remove `themes` section from `app/config/app.neon` file
Remove injection from your presenters and code added on installation.<commit_msg>Docs: update for version 2.1<commit_after>[![Travis](https://img.shields.io/travis/AnnotateFramework/themes.svg?style=flat-square)](https://travis-ci.org/AnnotateFramework/themes)
[![Code Climate](https://img.shields.io/codeclimate/github/AnnotateFramework/themes.svg?style=flat-square)](https://codeclimate.com/github/AnnotateFramework/themes)
[![Code Climate](https://img.shields.io/codeclimate/coverage/github/AnnotateFramework/themes.svg?style=flat-square)](https://codeclimate.com/github/AnnotateFramework/themes)


[![Packagist](https://img.shields.io/packagist/v/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)
[![Packagist](https://img.shields.io/packagist/dm/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)
[![Packagist](https://img.shields.io/packagist/dd/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)
[![Packagist](https://img.shields.io/packagist/dt/annotate/themes.svg?style=flat-square)](https://packagist.org/packages/annotate/themes)

Themes package for Annotate Framework
=====================================

This package provides powerfull themes support. You can create theme and override every template in theme.

Requirements
------------

Themes extension requires [annotate/templating](https://github.com/AnnotateFramework/templating). Register its extension to your neon config too.

Installation
------------

Require this extension by [Composer](http://getcomposer.org)

```sh
$ composer require annotate/themes:~2.1.0
```

Register extension into configuration:

```yml
extensions:
    templating: Annotate\Templating\DI\TemplatingExtension
    themes: Annotate\Themes\DI\ThemesExtension
```

Configure
---------

Themes path is configurable via Neon. Default `directory` value is `%appDir%/app/addons/themes/`.
To change themes open app/config/app.neon and add following configuration:

    themes:
        directory: %appDir%/app/
    
Now edit any of your presenters:

    class FrontendPresenter extends BasePresenter
    {
        /** @var Annotate\Themes\Loaders\ThemesLoader @inject */
        public $themesLoader;
    
        public function startup()
        {
            parent::startup();
            $this->themesLoader->activateTheme('theme name');
        }
    }
    
To have full functionality you have to either extend `Annotate\Framework\Application\BasePresenter` or copy its implementation to your `BasePresenter`

Create theme
------------

Create a file `theme_name.theme.neon` in themes directory with minimal structure:


```neon
name: My theme
```

Inheritance
-----------

Themes support one level inheritance you can specify parent theme by `extends` option in neon file:

```neon
name: My theme
extends: theme
```

Loading templates
-----------------

After activating theme app will search for template files this way:
 
 1. search for `%themeDir%/templates/%templateName`
 2. in case theme extends another theme it seaches for `%anotherThemeDir%/templates/%templateName%
 3. if no template was found above it searches for file in normal "Nette" way
{'fraction_non_alphanumeric': 0.15053763440860216, 'fraction_numerical': 0.001387443635102324, 'mean_word_length': 4.209575429087624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 29, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4451582', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1694, 'n_words': 366}