First basics for a skin (en): Unterschied zwischen den Versionen

Aus Gemini-Wiki
Zur Navigation springen Zur Suche springen
Zeile 204: Zeile 204:
 
Completed this would look like the '''Default-HD''' skin. If you want different graphics, you need to create some with an editor.
 
Completed this would look like the '''Default-HD''' skin. If you want different graphics, you need to create some with an editor.
  
=== Screens (Fenster) ===
+
=== Screens (windows) ===
  
Fenster bzw. Screen werden etwas später zwar erst behandelt, aber es passt hier halt mal mit rein bei dem Aufbau.
+
Windows or screens will be explained in detail later, but heres some basics already.
  
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
<!-- ein einfacher Screen beginnt mit dem Zeichen "<screen" und endet mit diesem Zeichen "/>" -->
+
<!-- a simple screen starts with "<screen" and ends with "/>" -->
 
<screen name="SubtitleDisplay" position="0,0" size="1280,720" zPosition="-1" flags="wfNoBorder" backgroundColor="transparent"/>
 
<screen name="SubtitleDisplay" position="0,0" size="1280,720" zPosition="-1" flags="wfNoBorder" backgroundColor="transparent"/>
 
</syntaxhighlight>  
 
</syntaxhighlight>  
  
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
<!-- ein erweiterter Screen beginnt mit dem Zeichen "<screen" -->
+
<!-- an advanced screen starts with "<screen" -->
 
                 <screen name="MoviePlayer" position="0,561" size="1280,133" title="InfoBar" backgroundColor="transparent" flags="wfNoBorder"
 
                 <screen name="MoviePlayer" position="0,561" size="1280,133" title="InfoBar" backgroundColor="transparent" flags="wfNoBorder"
 
<ePixmap pixmap="Default-HD/icons/icon_event.png" position="60,20" size="20,13" alphatest="on" />
 
<ePixmap pixmap="Default-HD/icons/icon_event.png" position="60,20" size="20,13" alphatest="on" />
Zeile 220: Zeile 220:
 
<convert type="ServiceName">Name</convert>
 
<convert type="ServiceName">Name</convert>
 
</widget>
 
</widget>
                 </screen> <!-- Endet aber somit! -->
+
                 </screen> <!-- ends like this! -->
<!-- Denn im erweitertem Fenster können oder müssen ja auch verschiedene Grafiken,Label und Widget integriert werden -->
+
<!-- because in an advanced screen you can integrate different graphics, labels and widgets -->
 
</syntaxhighlight>  
 
</syntaxhighlight>  
  
Zeile 228: Zeile 228:
  
  
Nachdem wir nun die Minimal-Konfiguration kennen, editiere ich mir nun die <code>skin.xml</code> folgendermaßen:
+
Now you know the minimal configuration, you can change the <code>skin.xml</code> like this:
  
* einfügen von meiner eigenen Grafik '''"borderset"''' also wie die Fenster aussehen sollen
+
* add a personal graphic '''"borderset"''' to change the look of the windows
* Anpassen der Farbpalette an meinen eigenen Wünschen
+
* addapt the colors as wanted
  
Das ganze sieht dann so aus:
+
It can be like this:
  
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
Zeile 312: Zeile 312:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Und starte dann dan [[Enigma2]] neu um die Änderungen zu übernehmen:
+
Restart [[Enigma2]] again to activate the changes:
  
 
{|
 
{|
|[[Bild:skin_minimal_Hauptmenue_BlackdreamHD.jpg|left|thumb|440px|Minimales Hauptmenü ohne zusätzlichen Grafiken]] ||
+
|[[Bild:skin_minimal_Hauptmenue_BlackdreamHD.jpg|left|thumb|440px|Minimal main menu without extra graphics]] ||
|[[Bild:skin_minimal_infoscreen_BlackdreamHD.jpg|right|thumb|440px|Infofenster, Grafiken der Buttons. werden vom defautlskin übernommen]] ||
+
|[[Bild:skin_minimal_infoscreen_BlackdreamHD.jpg|right|thumb|440px|Info window, the buttons come from the  default skin]] ||
 
|}
 
|}
  
sämtliche Menüfenster wie die Einstellungen, Timer und auch der Mediaplayer werden, da nichts gesetzt wurde hier von dem Defaultskin ausgegeben.
+
other menu windows - such as the settings, mediaplayer, ... - will remain in the default skin because no changes were made.
 
 
  
 
== Lesbarkeit der skin.xml ==
 
== Lesbarkeit der skin.xml ==

Version vom 4. Dezember 2012, 14:03 Uhr

Deutsch.png - in Deutsch English.png - in English

Introduction

This article explains the basics for a skin, which meets following conditions:

  • serves a basis for the skin.xml
  • and can be startet without crash


Your first skin.xml

The skin.xml is a file which influences the behaviour of the skin.
Normally this is the place where most of the screens are "skinned", the screens which were not skinned will be displayed using the "default-skin".

This means the structure of the Defaultskins is a good stating point for skinning. Also if something is changed in the OE 2.0 images, the Defaultskin should be the first skin which displays the new functions without problems. With the introduction of the new OE 2.0 a new HD skin Default-HD was introduced. It's allways a good idea to take a look at this one.

Later you can check the differences in the skins, look into the details and see what change is causing a specific change.


Ambox notice.png The skin.xml can be found in: usr/share/enigma2/ in the corresponding directory of the installed skin.


To start with your first skin which will start(without graphics, ...). Create following items in usr/share/enigma2/:

  • a new directory for your new skin (in this example we use BlackdreamHD)
  • a file skin.xml with minimal content (from the Skin Default-HD)


The skin.xml in OE 2.0, must contain following items to be bootable and not causing a crasht:

  • the definition of the skins <skin> </skin>
  • the definition of the resolution <output id="0"> </output>
  • the definition the colors <colors> </colors>
  • the definition the fonts <fonts> </fonts> (was not needed in OE 1.6)
  • the definition of the window colors <windowstyle> </windowstyle>


<skin>
 
	<!-- Head for Image resolution -->
	<output id="0">
	  <resolution xres="1280" yres="720" bpp="32" />
	</output>
 
 
	<!-- Colors (#AARRGGBB) -->
	<colors>
		<color name="black" value="#000000"/>
		<color name="white" value="#ffffff"/>
		<color name="grey" value="#b3b3b9"/>
		<color name="grey2" value="#d3d3d9"/>
		<color name="dark" value="#20062748"/>
		<color name="menu" value="#20062748"/>
		<color name="red" value="#f23d21"/>
		<color name="green" value="#389416"/>
		<color name="blue" value="#0064c7"/>
		<color name="yellow" value="#bab329"/>
		<color name="transparent" value="#ff000000"/>
		<color name="transpBlack" value="#80000000"/>
		<color name="transpWhite" value="#80ffffff"/>
		<color name="background" value="#200d1940"/>
		<color name="foreground" value="#ffffff"/>
	</colors>
 
 
	<!-- Fonts -->
	<fonts>
		<font filename="nmsbd.ttf" name="Regular" scale="100"/>
		<font filename="lcd.ttf" name="LCD" scale="100"/>
		<font filename="ae_AlMateen.ttf" name="Replacement" scale="100" replacement="1"/>
		<font filename="tuxtxt.ttf" name="Console" scale="100"/>
	</fonts>	
 
 
	<!-- Main screen colors (id=0 Framebuffer) -->
	<windowstyle type="skinned" id="0">
		<title offset="15,9" font="Regular;26" />
		<color name="Background" color="#200d1940"/>
		<color name="LabelForeground" color="#ffffff"/>
		<color name="ListboxBackground" color="#200d1940"/>
		<color name="ListboxForeground" color="#ffffff"/>
		<color name="ListboxSelectedBackground" color="#204176b6"/>
		<color name="ListboxSelectedForeground" color="#ffffff"/>
		<color name="ListboxMarkedBackground" color="#200d1940"/>
		<color name="ListboxMarkedForeground" color="#00ff00"/>
		<color name="ListboxMarkedAndSelectedBackground" color="#204176b6"/>
		<color name="ListboxMarkedAndSelectedForeground" color="#00ff00"/>
		<color name="WindowTitleForeground" color="#ffffff"/>
		<color name="WindowTitleBackground" color="#16244b"/>
	</windowstyle>
 
</skin>


Now we have no infobar and zapping occurs blind. Also the menu is very rudimentary. But the goal was to create a minimal skin which will not crash.

Minimal menu without extra graphics
Info window, for the buttons the graphics from the default skin are used


Background knowledge skin.xml

As the name of the skin.xml suggests, the structure of a skin is composed in a scripting language, with the name XML.

The XML works with markups and the skin is started by the first tag <skin>, and stopped with </skin>

In between all other markups are listed. Allways following the same scheme, the markup starts with the starttag <markupstart> and ends with an endtag </markupend> with a forward slash / after the first angle bracket.


Comments

Comments can be added as follows:

<!-- this is a comment -->
 
<!-- with these characters a comment starts
     and will only end  
     when these
     characters are set -->

Of course this can also be used to "disable" some lines in the skin.xml, to avoid some parts to be read at the start. This can be useful while skinning and testing.

Markups

<!-- The output markup defines the following -->
	<output id="0"> <!-- where the output is displayed, id="0" is the TV screen, (id=1 LCD), (id=2 Color OLED (dm800se) -->
	  <resolution xres="1280" yres="720" bpp="32" /> <!-- The size / resolution of the skin -->
	</output> <!-- end of the output markup -->


<!-- The color markup are using the HTML-color codes to assing a specific color -->
	<colors> <!-- markup start -->
		<color name="black" value="#000000"/> 
		<color name="white" value="#ffffff"/>
		<!-- by assigning the color we can use a name for colors in the skin 
                     this way we don't need to look up the code every time -->
	</colors> <!-- markup end -->


<!-- Fonts -->
	<fonts>
		<font filename="nmsbd.ttf" name="Regular" scale="100"/>
		<font filename="lcd.ttf" name="LCD" scale="100"/>
		<font filename="ae_AlMateen.ttf" name="Replacement" scale="100" replacement="1"/>
		<font filename="tuxtxt.ttf" name="Console" scale="100"/>
<!-- These are the standard fonts, other fonts can be installed if you want to use alternatives -->
	</fonts>


	<!-- Main screen colors (id=0 Framebuffer) -->
<!-- Here the colors for the different screen elements are defined together with the font and the size -->
	<windowstyle type="skinned" id="0">
		<title offset="15,9" font="Regular;26" />
		<color name="Background" color="#200d1940"/>
		<color name="LabelForeground" color="#ffffff"/>
		<color name="ListboxBackground" color="#200d1940"/>
		<color name="ListboxForeground" color="#ffffff"/>
		<color name="ListboxSelectedBackground" color="#204176b6"/>
		<color name="ListboxSelectedForeground" color="#ffffff"/>
		<color name="ListboxMarkedBackground" color="#200d1940"/>
		<color name="ListboxMarkedForeground" color="#00ff00"/>
		<color name="ListboxMarkedAndSelectedBackground" color="#204176b6"/>
		<color name="ListboxMarkedAndSelectedForeground" color="#00ff00"/>
		<color name="WindowTitleForeground" color="#ffffff"/>
		<color name="WindowTitleBackground" color="#16244b"/>
	</windowstyle>

If you want to use framed screens, take a look in the skin.xml of the Default-HD to see the structure:

This is also a submarkup which needs to be added to the markup windowstyle!!

	<!-- screen border png's -->
	<borderset name="bsWindow">
		<pixmap pos="bpTopLeft" filename="Default-HD/b_tl.png" />
		<pixmap pos="bpTop" filename="Default-HD/b_t.png"  />
		<pixmap pos="bpTopRight" filename="Default-HD/b_tr.png" />
		<pixmap pos="bpLeft" filename="Default-HD/b_lr.png"  />
		<pixmap pos="bpRight" filename="Default-HD/b_lr.png"  />
		<pixmap pos="bpBottomLeft" filename="Default-HD/b_bl.png" />
		<pixmap pos="bpBottom" filename="Default-HD/b_b.png"  />
		<pixmap pos="bpBottomRight" filename="Default-HD/b_br.png" />
	</borderset>

Completed this would look like the Default-HD skin. If you want different graphics, you need to create some with an editor.

Screens (windows)

Windows or screens will be explained in detail later, but heres some basics already.

<!-- a simple screen starts with "<screen" and ends with "/>" -->
<screen name="SubtitleDisplay" position="0,0" size="1280,720" zPosition="-1" flags="wfNoBorder" backgroundColor="transparent"/>
<!-- an advanced screen starts with "<screen" -->
                <screen name="MoviePlayer" position="0,561" size="1280,133" title="InfoBar" backgroundColor="transparent" flags="wfNoBorder"
		<ePixmap pixmap="Default-HD/icons/icon_event.png" position="60,20" size="20,13" alphatest="on" />
		<widget source="session.CurrentService" render="Label" position="100,12" size="850,27" font="Regular;24" valign="top" noWrap="1" backgroundColor="#263c59" transparent="1">
			<convert type="ServiceName">Name</convert>
		</widget>
                </screen> <!-- ends like this! -->
<!-- because in an advanced screen you can integrate different graphics, labels and widgets -->


Back to top TOC:


Now you know the minimal configuration, you can change the skin.xml like this:

  • add a personal graphic "borderset" to change the look of the windows
  • addapt the colors as wanted

It can be like this:

<skin>
	<!--  Skin:  BlackDreamHD for OE2.0 by EgLe (c)2012     -->
	<!--  This skin skin and all it's graphics are free. Everyone can modify and use it in other images.    -->
	<!-- Spezial Thanks to Kerni and Vali for his great Skins, Renderer,Converter and Wonderfull Idea  -->
	<!--  BUT DO NOT REMOVE OR CHANGE THE SECOND LINE !!!    -->
 
 
	<!-- Head for Image resolution -->
	<output id="0">
	  <resolution xres="1280" yres="720" bpp="32" />
	</output>
 
 
	<!-- Colors (#AARRGGBB) -->
	<colors>
		<color name="white"		value="#ffffff" />
		<color name="black"		value="#000000" />
		<color name="dark" 		value="#25062748" />
		<color name="red" 		value="#f23d21" />
		<color name="green" 		value="#5bac3f" />
		<color name="blue" 		value="#21b0cf" />
		<color name="grey" 		value="#90a0a0" />
		<color name="yellow" 		value="#00e5b243" />
		<color name="lightgrey" 	value="#8c8c93" />
		<color name="darkgrey"		value="#777777" />
		<color name="transparent" 	value="#ffffffff" />
		<color name="transpBlack" 	value="#80000000" />
		<color name="transpWhite" 	value="#80ffffff" />
		<color name="transpyellow"	value="#33bab329" />
		<color name="background"	value="#25272d33" />
		<color name="foreground"	value="#ffffff" />
		<color name="foreyellow"	value="#cc9329" />
	</colors>
 
 
	<!-- Fonts -->
	<fonts>
		<font filename="nmsbd.ttf" name="Regular" scale="95" />
		<font filename="lcd.ttf" name="LCD" scale="100" />
		<font filename="ae_AlMateen.ttf" name="Replacement" scale="95" replacement="1" />
		<font filename="tuxtxt.ttf" name="Console" scale="100" />
	</fonts>
 
 
	<!-- Main screen colors (id=0 Framebuffer) -->
	<windowstyle type="skinned" id="0">
		<title offset="33,14" font="Regular;27" />
		<color name="Background"				color="#272d33" />
		<color name="LabelForeground"			        color="#ffffff" />
		<color name="ListboxBackground" 			color="#272d33" />
		<color name="ListboxForeground" 			color="#ffffff" />
		<color name="ListboxSelectedBackground"                 color="#8c8c93" />
		<color name="ListboxSelectedForeground"                 color="#ffffff" />
		<color name="ListboxMarkedBackground"		        color="#2a2d2f" />
		<color name="ListboxMarkedForeground"                   color="#389416" />
		<color name="ListboxMarkedAndSelectedBackground"	color="#2a2d2f" />
		<color name="ListboxMarkedAndSelectedForeground"	color="#f23d21" />
		<color name="WindowTitleForeground"		        color="#ffffff" />
		<color name="WindowTitleBackground"		        color="#232a33" />
 
		<!-- Main screen border png's -->
		<borderset name="bsWindow">
			<pixmap pos="bpTopLeft" filename="BlackDreamHD/b_tl.png" />
			<pixmap pos="bpTop" filename="BlackDreamHD/b_t.png"  />
			<pixmap pos="bpTopRight" filename="BlackDreamHD/b_tr.png" />
			<pixmap pos="bpLeft" filename="BlackDreamHD/b_l.png"  />
			<pixmap pos="bpRight" filename="BlackDreamHD/b_r.png"  />
			<pixmap pos="bpBottomLeft" filename="BlackDreamHD/b_bl.png" />
			<pixmap pos="bpBottom" filename="BlackDreamHD/b_b.png"  />
			<pixmap pos="bpBottomRight" filename="BlackDreamHD/b_br.png" />
		</borderset>
	</windowstyle>
 
</skin>

Restart Enigma2 again to activate the changes:

Minimal main menu without extra graphics
Info window, the buttons come from the default skin

other menu windows - such as the settings, mediaplayer, ... - will remain in the default skin because no changes were made.

Lesbarkeit der skin.xml

Persönlich finde ich das man wie in jeder Sprache (Script, Progammier usw.) eine klare Struktur und Übersicht haben sollte.

Dies macht nicht nur für den Anfänger das ganze etwas Leichter sondern dient auch der Übersicht um eigene Fehler usw. zu finden.

Mit Kommentare sollte man sparsam umgehen, aber auch nicht geizen damit es eben klar und Übersichtlich bleibt.

Da der Grundskin soweit nun läuft ohne Crashs kommen die nächsten Elemete und auch evtl. eigene Grafiken zum Einsatz.

Hierbei folge ich meiner persönlichen Struktur und Reihenfolge die nicht eingehalten werden muss!


Hier kann man aber bei den jeweiligen Skinner und Mods mit ein bisschen Übung aber auch bald eine eigene "Typische Handschrift" erkennen...