Skip to content
Back to formatted view

Raw Message

Message-ID: <875x93owat.fsf@enricoschumann.net>
Date: 2026-01-15T13:11:22Z
From: Enrico Schumann
Subject: Custom theme with quantmod library
In-Reply-To: <87fr87owpg.fsf@enricoschumann.net> (Enrico Schumann's message of "Thu, 15 Jan 2026 14:02:35 +0100")

On Thu, 15 Jan 2026, Enrico Schumann writes:

> On Wed, 14 Jan 2026, Andre Luiz Tietbohl Ramos writes:
>
>> Hello,
>>
>> Is there a way to customize quantmod theme colors?  This great library
>> works fine however I rather change its color theme.  So far, I have been
>> able to use both white and black themes.
>> I tried to use the chartSeries theme command described below to no avail.
>> I tried even without a theme name, e.g. white or black. An example is below,
>>
>> stock.plot <- chartSeries(stock.time_interval,  ## ativo,
>>                           name = stock.name,
>>                           type = "candlestick",
>>                           subset='2025-07::2026-01',
>>                           theme = chartTheme("white", up.col='darkgreen',
>> dn.col='darkred',
>>                                              bg.col='gray',
>> selection.color='gray'),
>>                           TA = NULL
>>                           )
>>
>> Could anyone help, please?
>>
>> TIA,
>>
>> --
>> Andre Luiz Tietbohl Ramos, PhD
>>
>
> With quantmod 0.4.28 and R 4.5.2, and ESS (but on GNU/Linux),
> I can change colours, e. g.
>
>     library("quantmod")
>     getSymbols("AAPL")
>     
>     chartSeries(
>         AAPL,
>         type = "candlestick",
>         subset = '2025-07::2026-01',
>         theme = chartTheme("black",
>                            up.col = "blue"))
>
> gives me "blue" up-bars.  The same example also works
> when I run it from a terminal.
>
> Could this be some Apple-specific thing?

What happens when you send the graphic to a PDF, e.g.:

    pdf("some-file-name.pdf")
    library("quantmod")
    getSymbols("AAPL")
    
    chartSeries(
        AAPL,
        type = "candlestick",
        subset = '2025-07::2026-01',
        theme = chartTheme("black",
                           up.col = "blue"))
    dev.off()

Does the colour show up?


-- 
Enrico Schumann
Lucerne, Switzerland
https://enricoschumann.net