-
Notifications
You must be signed in to change notification settings - Fork 14
/
Get-Bootstrapped.ps1
177 lines (153 loc) · 13.6 KB
/
Get-Bootstrapped.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
function Get-Bootstrapped
{
<#
.Synopsis
Downloads a bootstrapper theme
.Description
Downloads a bootstrapper theme via the bootstraper builder hosted on Heroku
.Example
Get-Bootstrapped
.Notes
The bootstrapper builder was replaced by Bootstrap after version 3.
If this function continues to work, it is only because they continued to be nice about hosting the tool.
Since this change was made by Bootstrap, the primary option with a Pipeworks site uses a custom less.css page.
.Link
http://getbootstrap.com
#>
[OutputType([PSObject])]
param(
# The foreground color of the theme
#|Color
#|Default 0248b2
[Parameter(ValueFromPipelineByPropertyName=$true)]
[string]$ForegroundColor,
# The background color of the theme
#|Color
#|Default fafafa
[Parameter(ValueFromPipelineByPropertyName=$true)]
[string]$BackgroundColor,
# The color used for links in the theme
#|Color
#|Default 012456
[Parameter(ValueFromPipelineByPropertyName=$true)]
[string]$LinkColor,
# The fonts to use in the theme
#|Default Segoe UI, Arial, sans-serif
[Parameter(ValueFromPipelineByPropertyName=$true)]
[string]$FontFamily,
# The font size to use in the theme
#|Default 15px
[Parameter(ValueFromPipelineByPropertyName=$true)]
[string]$FontSize,
# The line height used in the theme.
#|Default 21px
[Parameter(ValueFromPipelineByPropertyName=$true)]
[string]$LineHeight,
# If set, will output a property bag containing the settings and the theme. If this is omitted, the theme will be directly returned.
[Switch]$OutputObject
)
process {
#region Inherit styles from a Pipeworks manifest if one is found
$fgColor= if ($foreGroundColor) {
"#" + $foreGroundColor.Trim('#')
} elseif ($pipeworksManifest.Style.Body.color) {
$pipeworksManifest.Style.Body.color
} else {
"#0248b2"
}
$lColor= if ($linkColor) {
'#' + $LinkColor.Trim('#')
} elseif ($pipeworksManifest.Style.a.color) {
$pipeworksManifest.Style.a.color
} else {
"#012456"
}
$bgColor= if ($backgroundColor) {
'#' + $backgroundColor.Trim('#')
} elseif ($pipeworksManifest.Style.body.'background-color') {
$pipeworksManifest.Style.body.'background-color'
} else {
"#fafafa"
}
$fontFam= if ($fontFamily) {
$FontFamily
} elseif ($pipeworksManifest.Style.body.'font-family') {
$pipeworksManifest.Style.body.'font-family'
} else {
"'Segoe UI', Helvetica, Arial, sans-serif"
}
$fs = if ($fontsize) {
$fontSize
} elseif ($pipeworksManifest.Style.body.'font-size') {
$pipeworksManifest.Style.body.'font-size'
} else {
'15px'
}
$lh = if ($lineHeight) {
$LineHeight
} elseif ($pipeworksManifest.Style.body.'line-height') {
$pipeworksManifest.Style.body.'line-height'
} else {
'21px'
}
#endregion Inherit styles from a Pipeworks manifest if one is found
# Download a customized bootstrap, containing their core color scheme.
$r = $null
$r =
Get-web -Url "http://bootstrap.herokuapp.com/" -Method POST -Parameter @{
js = '["bootstrap-transition.js","bootstrap-modal.js","bootstrap-dropdown.js","bootstrap-scrollspy.js","bootstrap-tab.js","bootstrap-tooltip.js","bootstrap-popover.js","bootstrap-affix.js","bootstrap-alert.js","bootstrap-button.js","bootstrap-collapse.js","bootstrap-carousel.js","bootstrap-typeahead.js"]'
css= '["reset.less","scaffolding.less","grid.less","layouts.less","type.less","code.less","labels-badges.less","tables.less","forms.less","buttons.less","sprites.less","button-groups.less","navs.less","navbar.less","breadcrumbs.less","pagination.less","pager.less","thumbnails.less","alerts.less","progress-bars.less","hero-unit.less","media.less","tooltip.less","popovers.less","modals.less","dropdowns.less","accordion.less","carousel.less","wells.less","close.less","utilities.less","component-animations.less","responsive-utilities.less","responsive-767px-max.less","responsive-768px-979px.less","responsive-1200px-min.less","responsive-navbar.less"]'
vars="{
`"@bodyBackground`":`"$bgColor`",
`"@inputBackground`":`"$fgColor`",
`"@tableBackground`":`"$bgColor`",
`"@heroUnitBackground`":`"$bgColor`",
`"@heroUnitHeadingColor`":`"$fgColor`",
`"@heroLeadColor`":`"$fgColor`",
`"@infoBackground`":`"$bgColor`",
`"@infoText`":`"$fgColor`",
`"@placeHolderText`":`"$fgColor`",
`"@headingsColor`":`"$fgColor`",
`"@tableBackgroundAccount`":`"$bgColor`",
`"@tableBackgroundHover`":`"$fgColor`",
`"@navbarBackground`":`"$bgColor`",
`"@navbarBackgroundHighlight`":`"$fgColor`",
`"@navbarSearchBackground`":`"$bgColor`",
`"@navbarLinkBackgroundActive`":`"$fgColor`",
`"@navbarSearchBackgroundFocus`":`"$fgColor`",
`"@navbarText`":`"$fgColor`",
`"@navbarBrandColor`":`"$fgColor`",
`"@navbarLinkColor`":`"$lColor`",
`"@navbarLinkColorHover`":`"$fgColor`",
`"@navbarLinkColorActive`":`"$fgColor`",
`"@dropDownBackground`":`"$bgColor`",
`"@textColor`":`"$fgColor`",
`"@dropdownBackground`":`"$bgColor`",
`"@dropdownLinkColor`":`"$lColor`",
`"@dropdownLinkColorHover`":`"$fgColor`",
`"@dropdownLinkBackgroundHover`":`"$lColor`",
`"@btnPrimaryBackground`":`"$bgColor`",
`"@btnPrimaryBackgroundHighlight`":`"$bgColor`",
`"@formActionsBackground`":`"$bgColor`",
`"@linkColor`":`"$lColor`",
`"@sansFontFamily`":`"$fontFam`",
`"@monoFontFamily`":`"Menlo, Monaco, 'Consolas'`",
`"@baseFontSize`":`"$fSize`",
`"@baseLineHeight`":`"$lh`"}"
img='["glyphicons-halflings.png","glyphicons-halflings-white.png"]'
} -AsByte -UseWebRequest
if ($OutputObject) {
$outObject = New-Object PSObject
$outObject | Add-member NoteProperty ForegroundColor $fgColor -Force
$outObject | Add-member NoteProperty BackgroundColor $bgColor -Force
$outObject | Add-member NoteProperty LinkColor $lColor -Force
$outObject | Add-member NoteProperty FontSize $fs -Force
$outObject | Add-member NoteProperty FontFamily $fontFam -Force
$outObject | Add-member NoteProperty LineHeight $lh -Force
$outObject | Add-Member NoteProperty ThemeData $r -Force
$outObject
} else {
$r
}
}
}