Announcement

  •  » Extensions
  •  » [resolved] [Dev helper] How to detect admin panel color in css file

#1 2014-01-24 17:59:08

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

[resolved] [Dev helper] How to detect admin panel color in css file

Hi all, guys !

I need a bit help from developers about how to do this :

A plugin of mine displays a table in his admin panel. Odd and even rows are colorized differently by using a personal css file and all works fine. But i use mostly the dark admin theme and the colors I chose match with it but absolutly not with the clear theme.

Is it a way to "detect" the admin theme used and make a "switch" in my css file ?

Hope I'm clear enough ;-)

Thx !

Offline

 

#2 2014-01-24 19:11:26

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: [resolved] [Dev helper] How to detect admin panel color in css file

It's OK, I got it !

For information, here is how to do :

1- Detecting the theme used:

Code:

        $themeconf=$template->get_template_vars('themeconf');
        $My_Var_theme=$themeconf['id'];

2- Telling to template the theme detected:

Code:

$template->assign(
  array(
    'MY_VAR_THEME'    => $My_Var_theme,
  )
);

3- In template file, combine css files according to theme detection:

Code:

{combine_css path= $path_to_my_css|@cat:'admin/template/my.css'}
{if $MY_VAR_THEME=='clear'}{combine_css path= $path_to_my_css|@cat:'admin/template/themes/clear/theme.css'}{/if}
{if $MY_VAR_THEME=='roma'}{combine_css path= $path_to_my_css|@cat:'admin/template/themes/roma/theme.css'}{/if}

4- And finally modifiyng the ./themes/*roma or clear*/theme.css files to display the good colors.


Hope it helps ! ;-)

Last edited by Eric (2014-01-24 19:32:59)

Offline

 

#3 2014-01-24 19:16:29

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [resolved] [Dev helper] How to detect admin panel color in css file

the var should always be available in $themeconf.id (always given to Smarty)

the value can't be "default", only "roma" or "clear"

Offline

 

#4 2014-01-24 19:32:22

Eric
Former Piwigo Team
VALENCE (FR)
2005-03-25
1768

Re: [resolved] [Dev helper] How to detect admin panel color in css file

mistic100 wrote:

the var should always be available in $themeconf.id (always given to Smarty)

Yes, I forgot it and remembered after posting here ;-)

mistic100 wrote:

the value can't be "default", only "roma" or "clear"

You are right. I fixed my previous posted code. Thx !

Offline

 
  •  » Extensions
  •  » [resolved] [Dev helper] How to detect admin panel color in css file

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact