Difference between revisions of "Theme Management API"

From WebOS Internals
Jump to navigation Jump to search
Line 18: Line 18:
 
# The themer must include a file for each CSS file that he wants to theme...  
 
# The themer must include a file for each CSS file that he wants to theme...  
 
#: If the css file being overridden is an application css, it must be placed in the exact same relative path as it would have been in the application.   
 
#: If the css file being overridden is an application css, it must be placed in the exact same relative path as it would have been in the application.   
#:: If the original application was /usr/palm/applications/phone/stylesheets/phone.css  the theming css must be in /media/internals/.themes/thisTheme//usr/palm/applications/phone/stylesheets/theme.css
+
#:: If the original application was /usr/palm/applications/phone/stylesheets/phone.css  the theming css must be in /media/internals/.themes/thisTheme//usr/palm/applications/phone/stylesheets/phone.css
#:: the theming file must ALWAYS be called "theme.css"
+
# If you are overriding one of the palm global stylesheets they must be placed in the correct place as well.  
# If you are overriding one of the palm global stylesheets they must be placed in the correct place as well.  /usr/palm/framework/stylesheets  and be named  themeXXXXX.css where XXXXX is the global stylesheet being overridden.  
 
 
# In your theme override stylesheets references to your images that override the default images should refer to /var/activetheme/... not to /media/internals/.theme/mytheme   
 
# In your theme override stylesheets references to your images that override the default images should refer to /var/activetheme/... not to /media/internals/.theme/mytheme   
 
# When your theme is chosen as the active theme, the system will symlink YOUR theme directory to /var/activetheme.
 
# When your theme is chosen as the active theme, the system will symlink YOUR theme directory to /var/activetheme.
  
A one-time patch will be made against the framework files in /user/palm/framework which will add loading themeXXX.css after each reference to XXXXX.css and which will modify launcher so that when an application is loaded,  after appname.css is loaded, theme.css will be loaded from /var/activetheme -- matching CSS classes from those files will then automatically override the previous ones from the defaults.
+
A one-time patch will be made against the framework files in /user/palm/framework which will add loading /var/activetheme/<orig_path>/XXX.css after each reference to <orig_path>/XXX.css and which will modify launcher so that when an application is loaded,  after appname.css is loaded, /var/activetheme/<app_dir>appname.css will be loaded -- matching CSS classes from those files will then automatically override the previous ones from the defaults.
  
 
==Writing the theming css files==  
 
==Writing the theming css files==  

Revision as of 23:11, 29 January 2010

Theme Management API

This is an initial attempt at hashing out a secure, reliable Theme Management API. One of the main goals is to modify as little as we can of stock Palm files.

  1. Create a new theme folder in /media/internal/.themes/thisTheme/
  2. Create a new themeinfo.json file in that folder which contains the following:
    • Themename: Display name for theme
    • themedesc: quoted text of html for description of theme
    • themethumb1: filename of thumbnail image 1 for theme
    • themethumb2: ditto image 2
    • themethumb3: ditto image 3
    • themeauthor: author name
    • themehome: URL of homepage for this theme
    • themeversion: version number
  3. In that new folder, place a file for each image that you intend to theme.
    The new file must be placed in the exact same relative path as before... that is to say, if the file was previously at /usr/palm/images/1.png then the new file must be at /media/internals/.themes/thisTheme/usr/palm/images/1.png
    The new file must have the same name, and be of the same type as the original file.
  4. The themer must include a file for each CSS file that he wants to theme...
    If the css file being overridden is an application css, it must be placed in the exact same relative path as it would have been in the application.
    If the original application was /usr/palm/applications/phone/stylesheets/phone.css the theming css must be in /media/internals/.themes/thisTheme//usr/palm/applications/phone/stylesheets/phone.css
  5. If you are overriding one of the palm global stylesheets they must be placed in the correct place as well.
  6. In your theme override stylesheets references to your images that override the default images should refer to /var/activetheme/... not to /media/internals/.theme/mytheme
  7. When your theme is chosen as the active theme, the system will symlink YOUR theme directory to /var/activetheme.

A one-time patch will be made against the framework files in /user/palm/framework which will add loading /var/activetheme/<orig_path>/XXX.css after each reference to <orig_path>/XXX.css and which will modify launcher so that when an application is loaded, after appname.css is loaded, /var/activetheme/<app_dir>appname.css will be loaded -- matching CSS classes from those files will then automatically override the previous ones from the defaults.

Writing the theming css files

Theming css files must be "sparse" that is, they ONLY contain the classes being overridden not the entire global css file. So, if for example you are overriding the "button_one" class in the phone application css, your theme.css in /thisTheme would be /usr/palm/applications/phone/stylesheets/theme.css and would contain ONE class

{button_one: 
   background-image: /var/activetheme/yadayadayada/1.png
}

NOTE NOTE NOTE -- I know that's wrong -- I'm trying to get an Idea out here ok?

Theme Management app

  • The theme management app iterates the folders in /media/internals/.themes and comes up with a list of themes folders in there.
  • It then opens each of the themeinfo.json files and displays a list of the available themes.
  • Upon tapping on a theme name a descriptive page (stolen from preware) comes up and displays the thumbnails and description and otherdata with an INSTALL button
  • Upon pressing install, the theme app's service symlinks /media/internal/.themes/chosenTheme to /var/activetheme


The Theme Management App also displays a command button which says something like: Get more themes. which accesses the compatible themes feeds. Any theme-manager compatible feeds are displayed using code which we steal from Preware.

The theme manager app can call the preware file service to get the theme feeds information.

It does NOT download the feeds by default, only on request by pressing "get more themes."

When a theme downloads, it extracts into /media/internal/.themes if the theme manager app attempts to open themedata.json and there isn't one, or it is corrupt, it informs the user that "this is not a theme manager compatible theme, sorry." and calls the service to delete the folder created by the IPK.