Labs/Ubiquity/Skins/: Difference between revisions

From MozillaWiki
< Labs‎ | Ubiquity
Jump to navigation Jump to search
(→‎Example Skin: Updated example skin for 0.1.7's altered DOM structure (see ubiq trac bug #612))
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Introduction=
=Introduction=


Skinning Ubiquity is easy. Firefox supports CSS3, which also adds a great number of features to make styling dependent on CSS alone easier.
Skinning Ubiquity is easy. Ubiquity styles are managed by a single CSS file that also contains metadata. While creating your skins locally, any changes in the CSS file will only be reflected when Firefox is restarted. To update the skin immediately, go to the Your Skins page and click on your skin again.


Ubiquity styles are managed by a single CSS file that also contains metadata.
=Metadata=
 
A set of elements and their descriptions from each is listed below.
 
==Metadata==


   /*
   /*
Line 19: Line 15:
   */
   */


Anywhere in your CSS file, you should describe the metadata in a format like above. All fields are optional but if you choose not to name your skin, the user will see a randomized name (and may never figure out which skin is yours).
In your CSS file, you should add the metadata in comments formatted as above. Your skin <b>must</b> have a name but all fields are optional.


==CSS Elements==
=CSS Elements=


'''#cmd-panel'''
'''#cmd-panel'''
Line 38: Line 34:


The container for the rest of the items, i.e. verb suggestions + preview pane.
The container for the rest of the items, i.e. verb suggestions + preview pane.


'''#ubiquity-preview '''
'''#ubiquity-preview '''


As of now, contains the width of the preview window.
As of now, contains the width of the preview window.
::''div#ubiquity-preview .gresult''
::Manages each Google search result.
::''div#ubiquity-preview .gresult a''
::The anchor properties of the Google search results, in this case, the title of the page.
::''div#ubiquity-preview .gresult-url''
::The properties for the URL showed under the description.
::''div#ubiquity-preview .gresult-content''
::The description properties for the Google result.
'''div#ubiquity-preview #preview-pane'''
The properties of the pane itself, such as borders, etc.


::''div#ubiquity-preview .hilited-text''
::''div#ubiquity-preview .hilited-text''
Line 88: Line 63:
::::The properties per icon image.
::::The properties per icon image.


=How Is It Done?=
'''div#ubiquity-preview #preview-pane'''


Simple, use the builtin skin editor to get started. If you want to use your own editor, save it to a file and install the skin. Any changes you make in the file will reflected instantly.
The properties of the area that contains the actual preview content. This should only include border/padding/margin information; the actual preview content may be in an iframe or browser element, so it's important that properties like background and text color be associated with the <tt>ubiquity-preview-content</tt> class.


Okay, moving on. Here is what the end result of trying to make a style was for me (a download link at the ''very'' end of the walkthrough):
'''.ubiquity-preview-content'''


[[Image:Skin01.png]]
The contents of the preview for the currently-selected command. This may be in an iframe or browser element, and as such it's important to note that this CSS class should contain all properties needed for it to "blend in" with the rest of the preview, since CSS styles may not be inherited from other parts of the skin.


The first step is to get an idea of a color scheme. I like blue and black, so I obviously picked those. For other color scheme ideas check out:
::''.ubiquity-preview-content .gresult''


[http://www.wellstyled.com/tools/colorscheme2/index-en.html|Color Scheme Generator]
::Manages each Google search result.


Now that you have this, the rest is easy. Yeah, that was the hardest part.  
::''.ubiquity-preview-content .gresult a''


Here is the browser.css:
::The anchor properties of the Google search results, in this case, the title of the page.
 
::''.ubiquity-preview-content .gresult-url''
 
::The properties for the URL showed under the description.
 
::''.ubiquity-preview-content .gresult-content''
 
::The description properties for the Google result.
 
=Sharing=
 
You can share your commands by linking to the CSS file. Just add the following code to any webpage:
 
<pre><link rel="ubiquity-skin" href="http://path-to-css" /></pre>
 
Anyone with Ubiquity who visits your page will be able to immediately install your skin.
 
https://wiki.mozilla.org/images/b/b0/Ubiquityskinnotification.png
 
For an example page where you can install skins, check [http://foyrek.com/test.html this] out.
 
=Example Skin=
 
https://wiki.mozilla.org/images/f/fd/Skin04.png


<pre>
<pre>
/* Blue for Ubiquity */
/* Edited by Yatrik Solanki */
/* exposure@yatriksolanki.com */


/* formatting for ubiquity pop-up */
/*
#panel {
  =skin=
  @name Default
  @author Yatrik Solanki
  @homepage http://www.yatriksolanki.com
  @email yatriksolanki@gmail.com
  @license MPL/LGPL/GPL
  =/skin=
*/
 
 
/* Formatting for the Ubiquity Pop-Up */
 
 
#cmd-panel {
   padding: 0px;
   padding: 0px;
   margin: 0px;
   margin: 10px;
   background: #272727;
   background: rgba(0%, 0%, 0%, 0.8);
  -moz-border-radius: 20px;
  -moz-border-radius-topleft: 0px;
}
}


#cmd-entry-container {
#cmd-entry-container {
   padding: 10px;
  margin: 8px;
   font-size: 12pt;
   padding: 3px;
   font-family: Helvetica, Arial;
   font-size: 14pt;
  border: 0px solid #aaa;
  -moz-border-radius: 0px;
  background: transparent;
   font-family: Calibri, Helvetica, Verdana, Arial;
}
}


#cmd-entry {
#cmd-entry {
   -moz-appearance: none;
   -moz-appearance: none;
  background: transparent;
   border: none;
   border: none;
   font-size: 14pt;
   font-size: 18pt;
  font-face: Helvetica, Arial;
   color: #ffffff;
  background: url("images/mid2.png");
   width: 100%;
   color: #4190E4;
   font-weight: bold;
  padding: 5px;
   font-family: Calibri, Helvetica, Verdana, Arial;
   width: 97%;
   border: 2px solid #5077A0;
   -moz-border-radius: 5px;
}
}


#cmd-preview {
#cmd-preview {
   -moz-appearance: none;
   -moz-appearance: none;
   border: none;
   border: none;
   padding: 10px;
   margin: 10px;
 
  overflow: hidden;
}
}
</pre>
You may notice some elements that are random, such as font-family properties in random places; this is because I was still figuring out what element affects what and was too lazy to change it back.
The background image used for the search box is a loopable image, since the box height can vary. I've set the width to 525px, and set the box width to 97% because of added padding.
I've also changed the font (who else here hates Times New Roman?) and the base colours.
Moving on to the preview.css file:


<pre>
/* Blue for Ubiquity */
/* Edited by Yatrik Solanki */
/* exposure@yatriksolanki.com */


body {
body#previewbody {
     margin: 0;
     margin: 0;
     padding: 0;
     padding: 0;
Line 163: Line 162:
}
}


#preview {
#ubiquity-preview {
     width: 500px;
     width: 500px;
}
}


/* formatting for data inside preview */
/* Formatting for the Preview Pane and Verb/Command suggestion list */
 
.gresult {
  margin-bottom: 10px;
}
.gresult a {
  color: #4190E4;
  text-decoration: underline;
  font-size: small;
  cursor: pointer;
  font-family: Helvetica, Arial;
}
.gresult-url {
  font-size: x-small;
  color: #4190E4;
  font-family: Helvetica, Arial;
}
.gresult-content {
  margin-right: 10px;
  font-size: x-small; 
  font-family: Helvetica, Arial;
}


div#ubiquity-preview #preview-pane {
    padding-left: 15px;
    padding: 7px;
    border-top: 1px solid #333;
    margin-top: 5px;
}


/* formatting for suggestion list */


#preview-pane {
div#ubiquity-preview .hilited-text {
     color: #ffffff;
     font-color: #FFF;
    background: url("images/mid2.png");
     font-family: Calibri, Helvetica, Verdana, Arial;
    padding-left: 15px;
    padding: 7px;
    border: 2px solid #5077A0;
    -moz-border-radius: 5px;
     font-family: Helvetica, Arial;
   
}
}


.hilited-text {
div#ubiquity-preview .hilited {
    /*border-left: solid 5px #0066cc;*/
     padding: 5px;
     padding: 5px;
     color: #548EF6;
     margin: 2px;
  font-family: Helvetica, Arial;;
    background: rgba(100%, 100%, 100%, 0.3);
}
.hilited {
    background: #404040;
    border: solid 2px #0E8BF1;
     -moz-border-radius: 5px;
     -moz-border-radius: 5px;
     color: #ffffff;
     color: #FFF;
    margin-bottom: 5px;
}
}
.suggested {
 
 
div#ubiquity-preview .suggested {
    margin: 2px;
     padding: 5px;
     padding: 5px;
     border: solid 2px #263A57;
     border-left: solid 10px transparent;
    -moz-border-radius: 5px;
     font-family: Calibri, Helvetica, Verdana, Arial;
     font-family: Helvetica, Arial;
     color: #FFF;
     margin-bottom: 5px;
}
}


 
div#ubiquity-preview .needarg {
.needarg {
     font-style: oblique;
     font-style: oblique;
     color: #999999;
     color: #999999;
  font-family: Helvetica, Arial;
}
}
.cmdicon {
div#ubiquity-preview .cmdicon {
     display: inline-block;
     display: inline-block;
     width: 16px;
     width: 16px;
}
}
.cmdicon img {
div#ubiquity-preview .cmdicon img {
     vertical-align: middle;
     vertical-align: middle;
     width: 16px;
     width: 16px;
     height: 16px;
     height: 16px;
}
}
</pre>


Whoo! A bit bigger.
/* Formatting for the Preview box */
Basically, styling for the selected/unselected text, and preview pane.
 
CSS3 was used for the border radius; Firefox supports this, so good to learn if you haven't already. Some great things you can do with it!
.ubiquity-preview-content {
  color: #ffffff;
  background: transparent;
  font-family: Calibri, Helvetica, Verdana, Arial;
  font-size: 11pt;
}
 
.ubiquity-preview-content .help {
  font-family: Calibri, Helvetica, Verdana, Arial;
  font-size: 11pt;
  color: #FFF;
}
 
.ubiquity-preview-content .gresult {
  margin-bottom: 10px;
}
 
.ubiquity-preview-content .gresult a {
  color: #FFFFFF;
  text-decoration: underline;
  font-size: 14pt;
  font-family: Calibri, Helvetica, Verdana, Arial;
  cursor: pointer;
}
.ubiquity-preview-content .gresult-url {
  font-size: x-small;
  font-family: Calibri, Helvetica, Verdana, Arial;
  color: #777;
}
.ubiquity-preview-content .gresult-content {
  margin-right: 10px;
  font-family: Calibri, Helvetica, Verdana, Arial;
  font-size: small; 
}
 
.ubiquity-preview-content.img {
    padding: 5px;
}


After that is done, you just have to restart Firefox. Of course, at this alpha stage, you just restart as you develop.


To download the above theme, "Blubiquity," check out the [[http://www.yatriksolanki.com/?p=11 Blubiquity Download Page]]
</pre>


=Skins and the Herd=
=Skins and the Herd=

Latest revision as of 18:19, 24 March 2009

Introduction

Skinning Ubiquity is easy. Ubiquity styles are managed by a single CSS file that also contains metadata. While creating your skins locally, any changes in the CSS file will only be reflected when Firefox is restarted. To update the skin immediately, go to the Your Skins page and click on your skin again.

Metadata

 /*
   =skin=
   @name Default
   @author Mozilla Labs
   @homepage http://labs.mozilla.com
   @email abimanyuraja@gmail.com
   @license MPL/LGPL/GPL
   =/skin=
 */

In your CSS file, you should add the metadata in comments formatted as above. Your skin must have a name but all fields are optional.

CSS Elements

#cmd-panel

Formatting for the actual popup layer.

#cmd-entry-container

Container for the entry box. Padding properties for around the box, for the most part.

#cmd-entry

Actual entry box. Fonts, padding, backgrounds, etc. All controlled here.

#cmd-preview

The container for the rest of the items, i.e. verb suggestions + preview pane.

#ubiquity-preview

As of now, contains the width of the preview window.

div#ubiquity-preview .hilited-text
Manages the currently selected verb/function's text property.
div#ubiquity-preview .hilited
Manages the currently selected verb/function's area; think of this as a hover property.
div#ubiquity-preview .suggested
The properties for the list of functions (i.e. google, wikipedia), those not selected.
div#ubiquity-preview .needarg
The property that manages the variables of different verb/functions. For example, the (message) and (to contact) areas in the "email" verb.
div#ubiquity-preview .cmdicon
The properties for the icon division, such as Google's "g."
div#ubiquity-preview img
The properties per icon image.

div#ubiquity-preview #preview-pane

The properties of the area that contains the actual preview content. This should only include border/padding/margin information; the actual preview content may be in an iframe or browser element, so it's important that properties like background and text color be associated with the ubiquity-preview-content class.

.ubiquity-preview-content

The contents of the preview for the currently-selected command. This may be in an iframe or browser element, and as such it's important to note that this CSS class should contain all properties needed for it to "blend in" with the rest of the preview, since CSS styles may not be inherited from other parts of the skin.

.ubiquity-preview-content .gresult
Manages each Google search result.
.ubiquity-preview-content .gresult a
The anchor properties of the Google search results, in this case, the title of the page.
.ubiquity-preview-content .gresult-url
The properties for the URL showed under the description.
.ubiquity-preview-content .gresult-content
The description properties for the Google result.

Sharing

You can share your commands by linking to the CSS file. Just add the following code to any webpage:

<link rel="ubiquity-skin" href="http://path-to-css" />

Anyone with Ubiquity who visits your page will be able to immediately install your skin.

Ubiquityskinnotification.png

For an example page where you can install skins, check this out.

Example Skin

Skin04.png


/*
  =skin=
  @name Default
  @author Yatrik Solanki
  @homepage http://www.yatriksolanki.com
  @email yatriksolanki@gmail.com
  @license MPL/LGPL/GPL
  =/skin=
*/


/* Formatting for the Ubiquity Pop-Up */


#cmd-panel {
  padding: 0px;
  margin: 10px;
  background: rgba(0%, 0%, 0%, 0.8);
  -moz-border-radius: 20px;
  -moz-border-radius-topleft: 0px;
}

#cmd-entry-container {
  margin: 8px;
  padding: 3px;
  font-size: 14pt;
  border: 0px solid #aaa;
  -moz-border-radius: 0px;
  background: transparent;
  font-family: Calibri, Helvetica, Verdana, Arial;
}

#cmd-entry {
  -moz-appearance: none;
  background: transparent;
  border: none;
  font-size: 18pt;
  color: #ffffff;
  width: 100%;
  font-weight: bold;
  font-family: Calibri, Helvetica, Verdana, Arial;
}

#cmd-preview {
  -moz-appearance: none;
  border: none;
  margin: 10px;
  overflow: hidden;
}


body#previewbody {
    margin: 0;
    padding: 0;
    color: #BBB;
}

#ubiquity-preview {
    width: 500px;
}

/* Formatting for the Preview Pane and Verb/Command suggestion list */

div#ubiquity-preview #preview-pane {
    padding-left: 15px;
    padding: 7px;
    border-top: 1px solid #333;
    margin-top: 5px;
} 


div#ubiquity-preview .hilited-text {
    font-color: #FFF;
    font-family: Calibri, Helvetica, Verdana, Arial;
}

div#ubiquity-preview .hilited {
    padding: 5px;
    margin: 2px;
    background: rgba(100%, 100%, 100%, 0.3);
    -moz-border-radius: 5px;
    color: #FFF;
}


div#ubiquity-preview .suggested {
    margin: 2px;
    padding: 5px;
    border-left: solid 10px transparent;
    font-family: Calibri, Helvetica, Verdana, Arial;
    color: #FFF;
}

div#ubiquity-preview .needarg {
    font-style: oblique;
    color: #999999;
}
div#ubiquity-preview .cmdicon {
    display: inline-block;
    width: 16px;
}
div#ubiquity-preview .cmdicon img {
    vertical-align: middle;
    width: 16px;
    height: 16px;
}

/* Formatting for the Preview box */

.ubiquity-preview-content {
  color: #ffffff;
  background: transparent;
  font-family: Calibri, Helvetica, Verdana, Arial;
  font-size: 11pt;
}

.ubiquity-preview-content .help {
  font-family: Calibri, Helvetica, Verdana, Arial;
  font-size: 11pt;
  color: #FFF;
}

.ubiquity-preview-content .gresult {
  margin-bottom: 10px;
}

.ubiquity-preview-content .gresult a {
  color: #FFFFFF;
  text-decoration: underline;
  font-size: 14pt;
  font-family: Calibri, Helvetica, Verdana, Arial;
  cursor: pointer;
}
.ubiquity-preview-content .gresult-url {
  font-size: x-small;
  font-family: Calibri, Helvetica, Verdana, Arial;
  color: #777;
}
.ubiquity-preview-content .gresult-content {
  margin-right: 10px;
  font-family: Calibri, Helvetica, Verdana, Arial;
  font-size: small;  
}

.ubiquity-preview-content.img {
    padding: 5px;
}


Skins and the Herd

As of now, there are plans to implement skin listing in the Herd. Updates will follow as they happen.