Übersicht Bootstrap-3-LESS-Variablen aus variables.less (Stand: Bootstrap 3.3.7)
Artikel ist obsolet/antiquiert!
In LESS kann man Variablen vordefinieren. Farbwerte, Paddings und mehr. Hilfreich z.B., will man mal einen Grauton etwas heller stellen, Man muss nicht in diversen Dateien die color-Werte anpassen, sondern kann das an 1 Stelle erledigen. Bootstrap 3 übertreibt mit diesem Feature etwas und ich suche mir regelmäßig einen Wolf. Erster Schritt, eine sortierbare Übersicht. Vielleicht hilft's was.
Da ich mittlerweile auf Bootstrap 4, dann 5, und SCSS/SASS umgestiegen bin, ist diese Liste lediglich für's Archiv, sozusagen.
Bootstrap-3-Variablen dynamisch ausgelesen
Gerenderte Ausgabe der Datei bootstrap-3-variables.php
/media/php-includes_ghsvs/less/3.3.7/variables.less
/media/php-includes_ghsvs/less/templates/sometemplate/variables.less
Alle 123 Einträge auf 1 Seite anzeigen
BS3-Original und Overrides des aktiven Templates
Variable | Bootstrap | Template | # |
---|---|---|---|
@font-size-base | 16px | 14px | 1 |
@screen-min | 320px | 2 | |
@screen-max | 1600px | 3 | |
@text-area-max-width | 1024px | 4 | |
@screen-xs-min | 480px | @screen-xs | 5 |
@screen-xxs-max | (@screen-xs-min - 1) | 6 | |
@screen-sm-min | 768px | @screen-sm | 7 |
@screen-xs-max | (@screen-sm-min - 1) | (@screen-sm-min - 1) | 8 |
@screen-sm2 | 840px | 9 | |
@screen-md-min | 992px | @screen-md | 10 |
@screen-sm-max | (@screen-md-min - 1) | (@screen-md-min - 1) | 11 |
@screen-md2 | 1024px | 12 | |
@screen-lg-min | 1200px | @screen-lg | 13 |
@screen-md-max | (@screen-lg-min - 1) | (@screen-lg-min - 1) | 14 |
@navbarCollapseWidth | 730px | 15 | |
@teaserJumpWidth | 609px | 16 | |
@rearrangeWidth | 609px | 17 | |
@navbarCollapseWidthSidebar | 767px | 18 | |
@navbarCollapsedFloatNone | 575px | 19 | |
@img-max-width-articlebody | @screen-xs-min | 20 | |
@navbar-height | 0 | 50px | 21 |
@navbar-margin-bottom | 0 | @line-height-computed | 22 |
@body-bg | @gray-lighter2 | #fff | 23 |
@text-color | @black | @gray-dark | 24 |
@text-bg | @white | 25 | |
@black | #000 | 26 | |
@blue | #0000ff | 27 | |
@blue-light | lighten(@blue, 45%) | 28 | |
@blueDark | #0064cd | 29 | |
@brown-light | #F4A460 | 30 | |
@green | #46a546 | 31 | |
@green-light | #CFC | 32 | |
@green-light2 | lighten(@green, 40%) | 33 | |
@orange | #fc8301 | 34 | |
@orange-light | #FC9 | 35 | |
@pink | #c3325f | 36 | |
@purple | #7a43b6 | 37 | |
@red | #781212 | 38 | |
@white | #ffffff | 39 | |
@yellow | #ffc40d | 40 | |
@yellow-light | #FFC | 41 | |
@gray-darker | #101010 | lighten(@gray-base, 13.5%) | 42 |
@gray-lighter | #ccc | lighten(@gray-base, 93.5%) | 43 |
@gray-lighter2 | #ddd | 44 | |
@gray-lighter3 | #eee | 45 | |
@gray-lighter4 | #e5e5e5 | 46 | |
@gray-lighter5 | #fafafa | 47 | |
@logoBgColor | #410000 | 48 | |
@separator-border-color | @blue | 49 | |
@page-header-border-color | @separator-border-color | @gray-lighter | 50 |
@brand-danger | @red | #d9534f | 51 |
@invalid-color | #ff0000 | 52 | |
@link-color | @red | @brand-primary | 53 |
@dropdownLinkColor | @gray-darker | 54 | |
@dropdownLinkColorHover | @white | 55 | |
@dropdown-link-hover-bg | @red | #f5f5f5 | 56 |
@dropdown-link-hover-color | @white | darken(@gray-dark, 5%) | 57 |
@component-active-color | @white | #fff | 58 |
@component-active-bg | @brand-danger | @brand-primary | 59 |
@close-color | @red | #000 | 60 |
@slicknav-btn-bg-color | @orange | 61 | |
@nav-pills-border-radius | 1 | @border-radius-base | 62 |
@font-family-sans-serif | Arial, Helvetica, "Arial Unicode MS", Sans-Serif | "Helvetica Neue", Helvetica, Arial, sans-serif | 63 |
@font-family-base | @font-family-sans-serif | @font-family-sans-serif | 64 |
@font-family-serif | Georgia, "Times New Roman", Times, serif | Georgia, "Times New Roman", Times, serif | 65 |
@font-family-monospace | Monaco, Menlo, Consolas, "Courier New", monospace | Menlo, Monaco, Consolas, "Courier New", monospace | 66 |
@fontFamilyHandschrift | "Just Me Again Down Here", Georgia, "Times New Roman", cursive | 67 | |
@headings-font-family | @font-family-sans-serif | inherit | 68 |
@headingsFontFamilyArticleBody | @headings-font-family | 69 | |
@headings-font-weight | normal | 500 | 70 |
@headings-color | @gray-darker | inherit | 71 |
@headingsColorDark | @black | 72 | |
@spaceVertical | @line-height-computed | 73 | |
@link-decoration | none | 74 | |
@navbar-default-bg | @gray-lighter5 | #f8f8f8 | 75 |
@tooltip-color | @black | #fff | 76 |
@tooltip-font-size | inherit | 77 | |
@tooltip-bg | @state-info-bg | #000 | 78 |
@tooltip-opacity | 1 | .9 | 79 |
@label-color | @white | #fff | 80 |
@label-link-hover-color | @white | #fff | 81 |
@label-tag-bg | #3a87ad | 82 | |
@label-categorytag-bg | @purple | 83 | |
@label-font-size | (@font-size-base * 0.9) | 84 | |
@label-color-catid84 | darken(@orange, 0%) | 85 | |
@label-color-catid91 | darken(@purple, 10%) | 86 | |
@label-color-catid92 | darken(@green, 10%) | 87 | |
@label-color-catid95 | darken(#dd0000, 0%) | 88 | |
@thumbnail-margin | (@line-height-computed/2) | 89 | |
@thumbnail-caption-margin-top | @thumbnail-caption-padding | 90 | |
@thumbnail-caption-bg | @state-info-bg | 91 | |
@thumbnail-caption-align | center | 92 | |
@thumbnail-caption-style | italic | 93 | |
@pagination-bg | @white | #fff | 94 |
@pagination-border | @gray-lighter2 | #ddd | 95 |
@pagination-hover-bg | @gray-lighter4 | @gray-lighter | 96 |
@pagination-hover-border | @gray-lighter2 | #ddd | 97 |
@pagination-active-color | @black | #fff | 98 |
@pagination-active-bg | @gray-lighter4 | @brand-primary | 99 |
@pagination-active-border | @gray-lighter2 | @brand-primary | 100 |
@pagination-disabled-bg | @white | #fff | 101 |
@pagination-disabled-border | @gray-lighter2 | #ddd | 102 |
@pagination-margin | 0 0 0 0 | 103 | |
@code-bg | @gray-lighter5 | #f9f2f4 | 104 |
@thumbnail-bg | lighten(@thumbnail-border, 10%) | @body-bg | 105 |
@thumbnail-border | @gray-lighter2 | #ddd | 106 |
@thumbnail-caption-padding | 4px | 9px | 107 |
@navbar-default-link-color | @red | #777 | 108 |
@navbar-default-link-hover-color | lighten(@yellow, 15%) | #333 | 109 |
@navbar-default-link-hover-bg | @red | transparent | 110 |
@navbar-default-link-active-color | @nav-pills-active-link-hover-color | #555 | 111 |
@navbar-default-link-active-bg | @nav-pills-active-link-hover-bg | darken(@navbar-default-bg, 6.5%) | 112 |
@navbar-nav-child-border | @gray | 113 | |
@nav-pills-active-link-hover-bg | @orange | @component-active-bg | 114 |
@nav-pills-active-link-hover-color | @white | @component-active-color | 115 |
@breadcrumb-margin | 0 | 116 | |
@breadcrumb-border-radius | 0 | 117 | |
@breadcrumb-bg | transparent | #f5f5f5 | 118 |
@breadcrumb-color | @black | #ccc | 119 |
@breadcrumb-padding-vertical | 15px | 8px | 120 |
@breadcrumb-padding-horizontal | 0 | 15px | 121 |
@breadcrumb-active-color | @gray-light | @gray-light | 122 |
@breadcrumb-separator | "|" | "/" | 123 |
Quelltext der Datei bootstrap-3-variables.php
<?php
/*
2015-10-11
bootstrap-3-variables.php
Variablen und Werte aus BS3-variables.less (Orig.) auslesen.
2015-10-17: zusätzlich Custom Werte aus template-eigener variables.less.
*/
?>
<?php
defined('_JEXEC') or die;
$selector = 'bootstrap-3-variables';
$html = array();
$link = '';
$countCollect = 0;
$app = JFactory::getApplication();
// Relevant für FooTable, wenn paging enabled
if (!($maxentries = $app->input->get->getInt('maxentries')))
{
$maxentries = 50;
}
$apologise = JText::_('ICOMOONCLASSES_APOLOGISE');
$file = '/media/php-includes_ghsvs/less/3.3.7/variables.less';
$fileAbs = JPATH_SITE . $file;
$template = $app->getTemplate();
$fileCustom = '/media/php-includes_ghsvs/less/templates/sometemplate/variables.less';
$fileCustomAbs = JPATH_SITE . $fileCustom;
if (!file_exists($fileAbs))
{
$html[] = '<p class="alert alert-error">Datei ';
$html[] = $file;
$html[] = ' nicht gefunden.';
$html[] = $apologise;
$html[] = '</p>';
}
elseif (!file_exists($fileCustomAbs))
{
$html[] = '<p class="alert alert-error">Datei ';
$html[] = $fileCustom;
$html[] = ' nicht gefunden.';
$html[] = $apologise;
$html[] = '</p>';
}
else
{
$link = '<p><a href="' . JUri::root(true) . $file . '" target="_blank">' . $file . '</a></p>';
$link .= '<p><a href="' . JUri::root(true) . $fileCustom . '" target="_blank">' . $fileCustom . '</a></p>';
$collect = collectLessVariablesGhsvs($fileAbs);
$countCollect = count($collect);
if ($countCollect)
{
$i = 0;
$collectCustom = collectLessVariablesGhsvs($fileCustomAbs);
$html[] = '<h4>BS3-Original und Overrides des aktiven Templates</h4>';
#$html[] = '<div class="table-responsive">';
$html[] = '<table class="table table-condensed table-bordered" id="' . $selector . '"';
$html[] = '>';
$html[] = '<thead>';
$html[] = '<tr>';
$html[] = '<th>Variable</th>';
$html[] = '<th data-breakpoints="xxs">Bootstrap</th>';
$html[] = '<th data-breakpoints="xs">Template</th>';
$html[] = '<th data-type="number">#</th>';
$html[] = '</tr>';
$html[] = '</thead>';
$html[] = '<tbody>';
foreach ($collect as $k => $v)
{
$vCustom = '';
$html[] = '<tr>';
$html[] = '<td data-ghsvs="toggle">' . $k . '</td>';
$html[] = '<td>' . $v . '</td>';
if (isset($collectCustom[$k]))
{
$vCustom = $collectCustom[$k];
unset($collectCustom[$k]);
}
$html[] = '<td>' . $vCustom . '</td>';
$html[] = '<td data-ghsvs="number">' . (++$i) . '</td>';
$html[] = '</tr>';
}
$html[] = '</tbody>';
$html[] = '</table>';
#$html[] = '</div><!--/table-responsive-->';
}
}
if (!count($html))
{
$html[] = '<p class="alert alert-error">Da ist wohl was schief gelaufen. ';
$html[] = $apologise;
$html[] = '</p>';
}
else
{
// Mehr Einträge in Tabelle anzeigen?
$uri = JUri::getInstance();
if ($countCollect > $maxentries)
{
$uri->setVar('maxentries', $countCollect);
$link .= '<p class=" btn btn-default text-fett" style="font-size:1.3em;"><a rel="nofollow" href="'.$uri.'#BELOWHEADER">Alle '.$countCollect.' Einträge auf 1 Seite anzeigen</a></p>';
}
########### FooTable 3 START ###########
// Speziell. Wir haben Footable auf unserem Server via Plugin installiert.
// Ggf. Zeilen entfernen
$options = array(
'empty' => JText::_('GHSVS_MODULES_FOOTABLE_EMPTY'),
'sorting' => array(
'enabled' => true
),
'filtering' => array(
'enabled' => true
),
'paging' => array(
'enabled' => ($countCollect > $maxentries) ? true : false,
'size' => $maxentries,
'countFormat' => JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', '{CP}', '{TP}'),
'current' => 1,
'limit' => 10,
'position' => 'left'
),
'state' => array(
'enabled' => true,
'filtering' => true,
'paging' => true,
'sorting' => true,
'key' => $selector
),
// Erster geöffnet. Auch nach Sortieren wird erster geöffnet.
'expandFirst' => false,
//'useParentWidth' => true,
'stopPropagation' => true,
// Leichteres Handling der Breakpoints. Nehmen drunter liegende mit.
'cascade' => true,
'breakpoints' => array(
// Du muss xxs eingeben, damit Spalte bei *xs* *verschwindet*!
'xxs' => 480,
'xs' => 620,
'sm' => 768,
'md' => 992,
'lg' => 1200,
),
);
JHtml::_('footableghsvs.footable', '#' . $selector, $options);
########### FooTable 3 ENDE ###########
echo '<style>table{
word-wrap: normal
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
-o-hyphens: none;
hyphens: none;
}
@-moz-document url-prefix() {
fieldset { display: table-cell; }
}
[data-ghsvs="toggle"]{
font-weight: bold;
background-color: #fafafa;
cursor:pointer;
}
[data-ghsvs="number"]{
text-align: right;
}
</style>';
}
echo $link . implode('', $html);
function collectLessVariablesGhsvs($fileAbs)
{
$lines = file($fileAbs);
$collect = array();
foreach ($lines as $i => $line){
$line = trim($line);
if (strpos($line, '@') !== 0 || strpos($line, ':') === false)
{
continue;
}
// Fix 2015-10-17.
// Derzeit verwendet BS3 nur "//" als Kommentarzeichen
if (strpos($line, '//') !== false)
{
$line = explode('//', $line, 2);
$line = $line[0];
}
$line = explode(':', $line, 2);
if (count($line) != 2){
continue;
}
// Vorsicht! Derzeit geht das noch mit Semikolon.
// Es sind aber auch Semikolons statt Komma zwischen
// Funktions-Parametern erlaubt.
// Siehe "Fix 2015-10-17"
// $parts = explode(';', $line[1], 2);
// $line[1] = trim($parts[0]);
$collect[trim($line[0])] = trim($line[1], ' ;');
}
return $collect;
}