In the preceding chapters we laid down the foundations you need to create Enyo apps. In this chapter, we’ll explore some of the pieces necessary to make those apps more memorable. We’ll cover how to style your apps, how to tune them to perform well on less powerful platforms, how to prepare them for translation to other languages, and how to diagnose things when bugs occur. As always, we’ll explore these concepts through interactive samples.
Enyo provides some very nice looking controls with the Onyx library. However, an app can set itself apart from others by having a unique user interface. Fortunately, it’s very easy to change the look of the Onyx widget set. We’ll explore several ways to accomplish that.
All Enyo controls have two published properties to aid in styling:
classes. These two properties correspond to an HTML element’s
class attributes. The
style property can be used to apply a specific style to a single control. To work with the
classes property, you must add CSS classes to a style sheet. In general, it is better to use
classes in an app for two reasons: a component is more reusable if a style is not embedded within it and by using a CSS class you can modify the style from a single place.
applyStyle() to update an individual style and
addStyles() to add styles onto the existing styles of a control. We used the
applyStyle() function in the traffic light sample at the start of the book. ...