Browse Source

add theme config option, add sky theme, fix line-height of <small>

Hakim El Hattab 12 years ago
parent
commit
90f343e5bd
5 changed files with 209 additions and 13 deletions
  1. 2 1
      css/main.css
  2. 169 0
      css/theme/sky.css
  3. 18 1
      index.html
  4. 9 1
      js/reveal.js
  5. 11 10
      js/reveal.min.js

+ 2 - 1
css/main.css

@@ -233,8 +233,9 @@ body {
 }
 
 .reveal small {
+	display: inline-block;
 	font-size: 0.6em;
-	line-height: 1em;
+	line-height: 1.2em;
 	vertical-align: top;
 }
 

+ 169 - 0
css/theme/sky.css

@@ -0,0 +1,169 @@
+/**
+ * Sky theme for reveal.js presentations.
+ * 
+ * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
+ */
+
+/*********************************************
+ * FONT-FACE DEFINITIONS
+ *********************************************/
+
+@import url(http://fonts.googleapis.com/css?family=Quicksand:400,700,400italic,700italic);
+@import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);
+
+
+
+/*********************************************
+ * GLOBAL STYLES
+ *********************************************/
+
+body {
+	font-family: 'Open Sans', sans-serif;
+	font-size: 36px;
+	font-weight: 200;
+	letter-spacing: -0.02em;
+	color: #333;
+
+	background: #f7fbfc;
+	background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPHJhZGlhbEdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzUlIj4KICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmN2ZiZmMiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjYWRkOWU0IiBzdG9wLW9wYWNpdHk9IjEiLz4KICA8L3JhZGlhbEdyYWRpZW50PgogIDxyZWN0IHg9Ii01MCIgeT0iLTUwIiB3aWR0aD0iMTAxIiBoZWlnaHQ9IjEwMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
+	background: -moz-radial-gradient(center, ellipse cover,  #f7fbfc 0%, #add9e4 100%);
+	background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#f7fbfc), color-stop(100%,#add9e4));
+	background: -webkit-radial-gradient(center, ellipse cover,  #f7fbfc 0%,#add9e4 100%);
+	background: -o-radial-gradient(center, ellipse cover,  #f7fbfc 0%,#add9e4 100%);
+	background: -ms-radial-gradient(center, ellipse cover,  #f7fbfc 0%,#add9e4 100%);
+	background: radial-gradient(ellipse at center,  #f7fbfc 0%,#add9e4 100%);
+}
+
+::-moz-selection {
+	background:rgba(79, 64, 28, 0.99);
+	color: white; 
+}
+::-webkit-selection {
+	background:rgba(79, 64, 28, 0.99);
+	color: white; 
+}
+::selection {
+	background:rgba(79, 64, 28, 0.99);
+	color: white; 
+}
+
+
+/*********************************************
+ * HEADERS
+ *********************************************/
+
+.reveal h1, 
+.reveal h2, 
+.reveal h3, 
+.reveal h4, 
+.reveal h5, 
+.reveal h6 {
+	margin: 0 0 20px 0;
+	color: #333;
+	font-family: 'Quicksand', sans-serif;
+	line-height: 0.9em;
+	letter-spacing: -0.08em;
+	
+	text-transform: uppercase;
+}
+
+
+/*********************************************
+ * LINKS
+ *********************************************/
+
+.reveal a:not(.image) {
+	color: #3b759e;
+	text-decoration: none;
+
+	-webkit-transition: color .15s ease;
+	   -moz-transition: color .15s ease;
+	    -ms-transition: color .15s ease;
+	     -o-transition: color .15s ease;
+	        transition: color .15s ease;
+}
+	.reveal a:not(.image):hover {
+		text-shadow: none;
+		border: none;
+		border-radius: 2px;
+	}
+
+.reveal .roll span:after {
+	color: #fff;
+	background: #3b759e;
+}
+
+
+/*********************************************
+ * MISC
+ *********************************************/
+
+.reveal section img {
+	margin: 30px 0 0 0;
+	background: rgba(255,255,255,0.12);
+	border: 1px solid #ddd;
+	
+	-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
+	   -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
+	        box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
+	
+	-webkit-transition: all .2s linear;
+	   -moz-transition: all .2s linear;
+	    -ms-transition: all .2s linear;
+	     -o-transition: all .2s linear;
+	        transition: all .2s linear;
+}
+
+	.reveal a:hover img {
+		background: rgba(255,255,255,0.2);
+		border-color: #3b759e;
+		
+		-webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.55);
+		   -moz-box-shadow: 0 0 20px rgba(0, 0, 0, 0.55);
+		        box-shadow: 0 0 20px rgba(0, 0, 0, 0.55);
+	}
+
+.reveal blockquote {
+	background: rgba(255, 255, 255, 0.4);
+}
+
+.reveal code {
+	background: rgba(255, 255, 255, 0.6);
+}
+
+.reveal p {
+	margin-bottom: 20px;
+}
+
+
+/*********************************************
+ * NAVIGATION CONTROLS
+ *********************************************/
+
+.reveal .controls a {
+	color: #fff;
+}
+	.reveal .controls a.enabled {
+		color: #3b759e;
+		text-shadow: 0px 0px 2px hsla(185, 45%, 70%, 0.3);
+	}
+
+
+/*********************************************
+ * PROGRESS BAR
+ *********************************************/
+
+.reveal .progress {
+	background: rgba(0,0,0,0.2);
+}
+	.reveal .progress span {
+		background: #3b759e;
+
+		-webkit-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
+		   -moz-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
+		    -ms-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
+		     -o-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
+		        transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
+	}
+
+

+ 18 - 1
index.html

@@ -15,7 +15,7 @@
 		<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
 		
 		<link rel="stylesheet" href="css/main.css">
-		<link rel="stylesheet" href="css/theme/default.css">
+		<link rel="stylesheet" href="css/theme/default.css" id="theme">
 
 		<!-- For syntax highlighting -->
 		<link rel="stylesheet" href="lib/css/zenburn.css">
@@ -151,6 +151,22 @@
 					</ul>
 				</section>
 
+				<section>
+					<h2>Themes</h2>
+					<p>
+						Reveal.js comes with a few themes built in: <br>
+						<a href="http://lab.hakim.se/reveal-js/?theme=sky">Sky</a> |
+						<a href="http://lab.hakim.se/reveal-js/?theme=beige">Beige</a> |
+						<a href="http://lab.hakim.se/reveal-js/?theme=simple">Simple</a> |
+						<a href="http://lab.hakim.se/reveal-js/">Default</a>
+					</p>
+					<p>
+						<small>
+							* Theme demos are loaded after the presentation which leads to flicker. In production you should load your theme in the <code>&lt;head&gt;</code> using a <code>&lt;link&gt;</code>.
+						</small>
+					</p>
+				</section>
+
 				<section>
 					<section data-state="alert">
 						<h2>Global State</h2>
@@ -296,6 +312,7 @@ function linkify( selector ) {
 				progress: true,
 				history: true,
 				
+				theme: Reveal.getQueryHash().theme || 'default', // available themes are in /css/theme
 				transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/linear(2d)
 
 				// Optional libraries used to extend on reveal.js

+ 9 - 1
js/reveal.js

@@ -1,5 +1,5 @@
 /*!
- * reveal.js 2.0 r20
+ * reveal.js 2.0 r21
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  * 
@@ -39,6 +39,9 @@ var Reveal = (function(){
 			// Apply a 3D roll to links on hover
 			rollingLinks: true,
 
+			// Transition style (see /css/theme)
+			theme: 'default', 
+
 			// Transition style
 			transition: 'default', // default/cube/page/concave/linear(2d),
 
@@ -111,6 +114,7 @@ var Reveal = (function(){
 		extend( config, options );
 
 		// Cache references to DOM elements
+		dom.theme = document.querySelector( '#theme' );
 		dom.wrapper = document.querySelector( '.reveal' );
 		dom.progress = document.querySelector( '.reveal .progress' );
 		dom.progressbar = document.querySelector( '.reveal .progress span' );
@@ -222,6 +226,10 @@ var Reveal = (function(){
 			dom.progress.style.display = 'block';
 		}
 
+		if( config.theme && dom.theme ) {
+			dom.theme.setAttribute( 'href', 'css/theme/' + config.theme + '.css' );
+		}
+
 		if( config.transition !== 'default' ) {
 			dom.wrapper.classList.add( config.transition );
 		}

+ 11 - 10
js/reveal.min.js

@@ -1,19 +1,20 @@
 /*!
- * reveal.js 2.0 r20
+ * reveal.js 2.0 r21
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  * 
  * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
  */
-var Reveal=(function(){var k=".reveal .slides>section",b=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),N={controls:true,progress:true,history:false,keyboard:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,transition:"default",dependencies:[]},l=0,c=0,w,E,ac=[],d={},P="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,m="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,x=0,j=0,B=0,W={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40};
-function h(ad){if((!m&&!P)){document.body.setAttribute("class","no-transforms");return;}r(N,ad);d.wrapper=document.querySelector(".reveal");d.progress=document.querySelector(".reveal .progress");
-d.progressbar=document.querySelector(".reveal .progress span");if(N.controls){d.controls=document.querySelector(".reveal .controls");d.controlsLeft=document.querySelector(".reveal .controls .left");
-d.controlsRight=document.querySelector(".reveal .controls .right");d.controlsUp=document.querySelector(".reveal .controls .up");d.controlsDown=document.querySelector(".reveal .controls .down");
-}R();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll";document.body.style.height="120%";window.addEventListener("load",X,false);
-window.addEventListener("orientationchange",X,false);}}function R(){var ae=[],ai=[];for(var af=0,ad=N.dependencies.length;af<ad;af++){var ag=N.dependencies[af];
-if(!ag.condition||ag.condition()){if(ag.async){ai.push(ag.src);}else{ae.push(ag.src);}if(typeof ag.callback==="function"){head.ready(ag.src.match(/([\w\d_-]*)\.?[^\\\/]*$/i)[0],ag.callback);
-}}}function ah(){head.js.apply(null,ai);F();}if(ae.length){head.ready(ah);head.js.apply(null,ae);}else{ah();}}function F(){C();I();H();K();}function I(){if(P===false){N.transition="linear";
-}if(N.controls&&d.controls){d.controls.style.display="block";}if(N.progress&&d.progress){d.progress.style.display="block";}if(N.transition!=="default"){d.wrapper.classList.add(N.transition);
+var Reveal=(function(){var k=".reveal .slides>section",b=".reveal .slides>section.present>section",e=!!("ontouchstart" in window),N={controls:true,progress:true,history:false,keyboard:true,loop:false,autoSlide:0,mouseWheel:true,rollingLinks:true,theme:"default",transition:"default",dependencies:[]},l=0,c=0,w,E,ac=[],d={},P="WebkitPerspective" in document.body.style||"MozPerspective" in document.body.style||"msPerspective" in document.body.style||"OPerspective" in document.body.style||"perspective" in document.body.style,m="WebkitTransform" in document.body.style||"MozTransform" in document.body.style||"msTransform" in document.body.style||"OTransform" in document.body.style||"transform" in document.body.style,x=0,j=0,B=0,W={startX:0,startY:0,startSpan:0,startCount:0,handled:false,threshold:40};
+function h(ad){if((!m&&!P)){document.body.setAttribute("class","no-transforms");return;}r(N,ad);d.theme=document.querySelector("#theme");d.wrapper=document.querySelector(".reveal");
+d.progress=document.querySelector(".reveal .progress");d.progressbar=document.querySelector(".reveal .progress span");if(N.controls){d.controls=document.querySelector(".reveal .controls");
+d.controlsLeft=document.querySelector(".reveal .controls .left");d.controlsRight=document.querySelector(".reveal .controls .right");d.controlsUp=document.querySelector(".reveal .controls .up");
+d.controlsDown=document.querySelector(".reveal .controls .down");}R();if(navigator.userAgent.match(/(iphone|ipod|android)/i)){document.documentElement.style.overflow="scroll";
+document.body.style.height="120%";window.addEventListener("load",X,false);window.addEventListener("orientationchange",X,false);}}function R(){var ae=[],ai=[];
+for(var af=0,ad=N.dependencies.length;af<ad;af++){var ag=N.dependencies[af];if(!ag.condition||ag.condition()){if(ag.async){ai.push(ag.src);}else{ae.push(ag.src);
+}if(typeof ag.callback==="function"){head.ready(ag.src.match(/([\w\d_-]*)\.?[^\\\/]*$/i)[0],ag.callback);}}}function ah(){head.js.apply(null,ai);F();}if(ae.length){head.ready(ah);
+head.js.apply(null,ae);}else{ah();}}function F(){C();I();H();K();}function I(){if(P===false){N.transition="linear";}if(N.controls&&d.controls){d.controls.style.display="block";
+}if(N.progress&&d.progress){d.progress.style.display="block";}if(N.theme&&d.theme){d.theme.setAttribute("href","css/theme/"+N.theme+".css");}if(N.transition!=="default"){d.wrapper.classList.add(N.transition);
 }if(N.mouseWheel){document.addEventListener("DOMMouseScroll",n,false);document.addEventListener("mousewheel",n,false);}if(N.rollingLinks){J();}}function C(){document.addEventListener("touchstart",y,false);
 document.addEventListener("touchmove",Z,false);document.addEventListener("touchend",S,false);window.addEventListener("hashchange",u,false);if(N.keyboard){document.addEventListener("keydown",aa,false);
 }if(N.controls&&d.controls){d.controlsLeft.addEventListener("click",o(z),false);d.controlsRight.addEventListener("click",o(i),false);d.controlsUp.addEventListener("click",o(s),false);