Style Language
Definition
Reference:
“Style Language is a computer language that expresses the presentation of structured documents.” Wikipedia
Problem
Style | Output |
---|---|
Color | Lorem ipsum |
Size | Lorem ipsum |
Bold | Lorem ipsum |
Italic | Lorem ipsum |
Underline | Lorem ipsum |
Font Family | Lorem ipsum |
Styling (size + color)
Lorem ipsum
Output:
Lorem ipsum
Android Style
Reference:
- R.color
- TextView: android:textSize, android:textColor
- TextView Attributes
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:text="Lorem ipsum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="36sp"
android:fontFamily="sans-serif-light"
android:textColor="@android:color/holo_blue_dark"
android:padding="20dp"/>
</RelativeLayout>
Output:
Fonte: labs.udacity
LaTeX Style
Reference:
\documentclass{article}
\usepackage{color}
\begin{document}
{\color{blue}\Large{Lorem ipsum dolor}}
\end{document}
Output: overleaf
Open Document Style
Reference:
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content ... office:version="1.2">
...
<office:automatic-styles>
...
<style:style style:name="T1" style:family="text">
<style:text-properties fo:color="#0000ff" fo:font-size="18pt" ... />
</style:style>
</office:automatic-styles>
<office:body>
<office:text>
...
<text:p text:style-name="P1">
<text:span text:style-name="T1">Lorem ipsum dolor</text:span>
</text:p>
</office:text>
</office:body>
</office:document-content>
Output: tex.odt
Qt Style
Reference:
#include <QApplication>
#include <QLabel>
int main(int argc, char **argv)
{
QApplication app (argc, argv);
QLabel* label = new QLabel("Lorem ipsum dolor");
label->setStyleSheet("QLabel { color : blue; font-size : 17px");
label->show();
return app.exec();
}
CSS
Reference:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p style="color:blue;font-size:20px;">Lorem ipsum dolor</p>
</body>
</html>
Output:
Lorem ipsum dolor
CSS File
site
├── index.html
└── style.css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<p>Lorem ipsum dolor</p>
</body>
</html>
p {
color:blue;
font-size:20px;
}
Output:
Lorem ipsum dolor
Comparing
style | Android | LaTeX | ODT | Qt | CSS |
---|---|---|---|---|---|
color | android:textColor | \color | color | color | color |
size | android:textSize | \Large | font-size | font-size | font-size |
Remember
- Style Language have terms that define style properties
- Style Language can work:
- with other languages
- declarative and imperative
- locally or globally