Official blog

LearnDoubleEntry.org official blog

Sunday, March 29, 2015

What about colored accounts?

As an experimental feature, we added the possibility of having different styles associated with accounts in the journal of the public page and in the slideshow of a firm, here at LearnDoubleEntry.org.

Let's say you want to have all assets in blue, all liabilities in red, all revenues in green and all expenses in orange.

It's quite easy. By using the keyword @classes in the comments text box, you can specify a class for each account:


Well, actually you don't need to do that for each account. The classes you specify are automatically inherited by all the children accounts.

In the Chart of Accounts page, at the bottom, you'll find a link saying Toggle visibility of classes that helps you visualize how inheritance is applied.

For instance, you should see that all accounts children of Asset Accounts are automatically assigned the class assets:

An account can have more than a class, and inheritance is not affected. This might be useful because in a complex chart of accounts you could desire to have a distinction between fixed assets and current assets. Nothing prevents you to specify a class assets at the main level, and an additional class fixed at a lower level. The result will be that you'll have two classes for the children accounts, like fixed assets.

If you want to prevent inheritance, you can put an exclamation mark after the class name.

Once you have defined your classes, how can you get colors? In the page of the configuration of the firm, click on Show advanced options: you will be presented a text area named CSS.


Here, you can past the following text (provided as an example; you can of course adapt it to your own needs):

.assets
{
  color: blue;
}

.liabilities
{
  color: red;
}

.revenues
{
  color: green;
}

.expenses
{
  color: orange;
}

and click on Save. The result should be what you expect, a colored journal:


If you want to know more about CSS, start with reading the pages at W3School, and if you have ideas for improvements, please share them with us.

No comments:

Post a Comment