Bootstrap: How do I change the black bar at the top?

49 views
Skip to first unread message

Jason Hsu, Android developer

unread,
Jun 8, 2013, 2:50:22 AM6/8/13
to rubyonra...@googlegroups.com
Chapter 5 of railstutorial.org (http://ruby.railstutorial.org/chapters/filling-in-the-layout#top) talks about how to create a basic layout for a web site.  I use it as a great resource for putting a Rails web site together.

I'm having difficulty customizing the navbar/header.  While changing the color of the "sample app" logo is straightforward enough (just change the RGB setting of the color parameter under #logo), how do I change parameters in the rest of the header?  How do I change that black bar to be some other color, such as dark blue/green/red/purple/brown/etc.?  How do I change the color of the menu links (Home/Help/Sign Up) from the default gray to yellow?  Or orange?  Or some other color?

Nick van der Wildt

unread,
Jun 17, 2013, 2:46:23 PM6/17/13
to rubyonra...@googlegroups.com
You'll have to customise it by using sass. Read here on how to do that:
https://github.com/thomas-mcdonald/bootstrap-sass#configuration

The bootstrap variables you can use can be found in:
http://twitter.github.com/bootstrap/customize.html#variables

Hope this works out for you!

--
Posted via http://www.ruby-forum.com/.

Nick van der Wildt

unread,
Jun 17, 2013, 3:24:35 PM6/17/13
to rubyonra...@googlegroups.com
Additional tips, using the railstutorial from Michael Hartl:

1. Where you have specified the navbar html, remove navbar-inverse if
it's there.. it should give you the default light-grey navbar
2. Open up app/assets/stylesheets/custom.css.scss
3. Add and customise the values of:
$navbarBackground: #FF6600;
$navbarBackgroundHighlight: #FF6600;
$navbarText: #FFF;
$navbarBrandColor: #FFF;
$navbarLinkColor: #FFF;
$navbarLinkColorHover: #FFF;
$navbarLinkColorActive: #000;
$navbarLinkBackgroundHover: #FF7F00;
$navbarLinkBackgroundActive: #FF7F00;
$navbarSearchBackground: #FFF;
$navbarSearchBackgroundFocus: #FFF;
$navbarSearchBorder: #FFF;
$navbarSearchPlaceholderColor: #FFF;

Note: make absolutely sure you do this before you import bootstrap
(@import "bootstrap";), because SASS will respect whatever you have
defined before the import.

I hope this helps you better. Have fun learning Rails!
Reply all
Reply to author
Forward
0 new messages