netbox.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. // Netbox-specific Styles and Overrides.
  2. @use 'sass:map';
  3. :root {
  4. --nbx-logo-color-1: #9cc8f8;
  5. --nbx-logo-color-2: #1685fc;
  6. --nbx-sidebar-bg: #{$gray-100};
  7. --nbx-sidebar-link-color: #{$gray-800};
  8. --nbx-sidebar-link-hover-bg: #{$blue-100};
  9. --nbx-sidebar-title-color: #{$text-muted};
  10. --nbx-breadcrumb-bg: #{$light};
  11. --nbx-body-bg: #{$white};
  12. --nbx-body-color: #{$black};
  13. --nbx-pre-bg: #{$gray-100};
  14. --nbx-pre-border-color: #{$gray-600};
  15. --nbx-change-added: #{rgba($green, 0.4)};
  16. --nbx-change-removed: #{rgba($red, 0.4)};
  17. --nbx-cable-node-bg: #{$gray-100};
  18. --nbx-cable-node-border-color: #{$gray-200};
  19. --nbx-cable-termination-bg: #{$gray-200};
  20. --nbx-cable-termination-border-color: #{$gray-300};
  21. body[data-netbox-color-mode='dark'] {
  22. --nbx-logo-color-1: #{$white};
  23. --nbx-logo-color-2: #{$gray-200};
  24. --nbx-sidebar-bg: #{$gray-800};
  25. --nbx-sidebar-link-color: #{$gray-200};
  26. --nbx-sidebar-link-hover-bg: #{rgba($blue-300, 0.15)};
  27. --nbx-sidebar-title-color: #{$gray-300};
  28. --nbx-breadcrumb-bg: #{$gray-800};
  29. --nbx-body-bg: #{$gray-900};
  30. --nbx-body-color: #{$white};
  31. --nbx-pre-bg: #{$gray-700};
  32. --nbx-pre-border-color: #{$gray-600};
  33. --nbx-change-added: #{rgba($green-300, 0.4)};
  34. --nbx-change-removed: #{rgba($red-300, 0.4)};
  35. --nbx-cable-node-bg: #{$gray-700};
  36. --nbx-cable-node-border-color: #{$gray-600};
  37. --nbx-cable-termination-bg: #{$gray-800};
  38. --nbx-cable-termination-border-color: #{$gray-700};
  39. }
  40. }
  41. * {
  42. transition: background-color, color 0.15s ease-in-out;
  43. }
  44. .text-xs {
  45. font-size: $font-size-xs;
  46. line-height: $line-height-sm;
  47. }
  48. body {
  49. background-color: var(--nbx-body-bg);
  50. color: var(--nbx-body-color);
  51. g#netbox-logo-1 {
  52. fill: #9cc8f8;
  53. stroke: #9cc8f8;
  54. }
  55. g#netbox-logo-2 {
  56. fill: #1685fc;
  57. stroke: #1685fc;
  58. }
  59. &[data-netbox-color-mode='light'] {
  60. .btn.btn-primary {
  61. color: $white;
  62. }
  63. }
  64. &[data-netbox-color-mode='dark'] {
  65. a:not(.btn) {
  66. color: $blue-300;
  67. }
  68. .breadcrumb .breadcrumb-item > a {
  69. color: $blue-300;
  70. }
  71. .badge {
  72. color: $black;
  73. }
  74. .card,
  75. .sidebar {
  76. .text-muted {
  77. color: $gray-400 !important;
  78. }
  79. }
  80. .text-body[class] {
  81. color: var(--nbx-body-color) !important;
  82. }
  83. g#netbox-logo-1 {
  84. fill: $white;
  85. stroke: $white;
  86. }
  87. g#netbox-logo-2 {
  88. fill: $gray-200;
  89. stroke: $gray-200;
  90. }
  91. }
  92. table {
  93. &.table > :not(caption) > * > * {
  94. padding-left: $table-cell-padding-x-sm !important;
  95. padding-right: $table-cell-padding-x-sm !important;
  96. }
  97. td,
  98. th {
  99. font-size: $font-size-xs;
  100. line-height: $line-height-sm;
  101. vertical-align: middle;
  102. }
  103. &.attr-table {
  104. td,
  105. th {
  106. font-size: $font-size-sm;
  107. line-height: $line-height-sm;
  108. }
  109. }
  110. }
  111. }
  112. div.title-container {
  113. display: flex;
  114. justify-content: space-between;
  115. flex-wrap: wrap;
  116. align-items: center;
  117. padding-top: $spacer * 2;
  118. margin-bottom: $spacer * 2;
  119. border-bottom: 1px solid $border-color;
  120. div#content-title {
  121. display: flex;
  122. flex-direction: column;
  123. flex: 1 0 auto;
  124. padding-bottom: map.get($spacers, 2);
  125. }
  126. }
  127. nav.search {
  128. background-color: var(--nbx-body-bg);
  129. }
  130. main.login-container {
  131. display: flex;
  132. height: calc(100vh - 4rem);
  133. width: 100vw;
  134. align-items: center;
  135. justify-content: center;
  136. flex-direction: column;
  137. padding-top: 40px;
  138. padding-bottom: 40px;
  139. }
  140. footer.login-footer {
  141. height: 4rem;
  142. margin-top: auto;
  143. .container-fluid {
  144. display: flex;
  145. justify-content: flex-end;
  146. padding: $container-padding-x $grid-gutter-width;
  147. }
  148. }
  149. h1 {
  150. font-weight: $font-weight-bolder;
  151. }
  152. h2 {
  153. font-weight: $font-weight-bold;
  154. }
  155. h3,
  156. h4 {
  157. font-weight: $font-weight-medium;
  158. }
  159. h5,
  160. h6 {
  161. font-weight: $font-weight-medium;
  162. }
  163. h1.accordion-item-title,
  164. h2.accordion-item-title,
  165. h3.accordion-item-title,
  166. h4.accordion-item-title,
  167. h5.accordion-item-title,
  168. h6.accordion-item-title {
  169. padding: 0 0.5rem;
  170. font-weight: $font-weight-bold;
  171. text-transform: uppercase;
  172. color: var(--nbx-sidebar-title-color);
  173. font-size: $font-size-sm;
  174. }
  175. .form-login {
  176. width: 100%;
  177. max-width: 330px;
  178. padding: 15px;
  179. // margin: auto;
  180. }
  181. .form-login input[type='text'] {
  182. margin-bottom: -1px;
  183. border-bottom-right-radius: 0;
  184. border-bottom-left-radius: 0;
  185. }
  186. .form-login input[type='password'] {
  187. margin-bottom: 10px;
  188. border-top-left-radius: 0;
  189. border-top-right-radius: 0;
  190. }
  191. .form-login .form-control {
  192. position: relative;
  193. box-sizing: border-box;
  194. height: auto;
  195. padding: 10px;
  196. font-size: 16px;
  197. }
  198. li.dropdown-item.dropdown-item-btns {
  199. display: flex;
  200. justify-content: space-between;
  201. align-items: center;
  202. }
  203. @media (max-width: 767.98px) {
  204. .sidebar {
  205. top: 5rem;
  206. }
  207. }
  208. .sidebar-sticky {
  209. position: relative;
  210. top: 0;
  211. height: calc(100vh - 48px);
  212. padding-top: 0.5rem;
  213. overflow-x: hidden;
  214. overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
  215. }
  216. .navbar-brand {
  217. padding-top: 0.75rem;
  218. padding-bottom: 0.75rem;
  219. font-size: 1rem;
  220. }
  221. nav.nav.nav-pills {
  222. .nav-item.nav-link {
  223. padding: 0.25rem 0.5rem;
  224. font-size: $font-size-base;
  225. border-radius: $border-radius;
  226. &:hover {
  227. color: $body-color;
  228. background-color: var(--nbx-sidebar-link-hover-bg);
  229. }
  230. }
  231. }
  232. .sidebar {
  233. position: fixed;
  234. top: 0;
  235. bottom: 0;
  236. left: 0;
  237. z-index: 100; /* Behind the navbar */
  238. box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.1);
  239. background-color: var(--nbx-sidebar-bg);
  240. .sidebar-nav-link {
  241. color: var(--nbx-sidebar-link-color);
  242. }
  243. .accordion-body {
  244. max-height: calc(100vh - 24rem);
  245. overflow-y: auto;
  246. .nav-item {
  247. .nav-link {
  248. padding: 0.25rem 0.5rem;
  249. font-size: $font-size-base;
  250. border-radius: $border-radius;
  251. &:hover {
  252. color: $body-color;
  253. background-color: var(--nbx-sidebar-link-hover-bg);
  254. }
  255. }
  256. }
  257. }
  258. div.position-sticky {
  259. height: calc(100% - 8rem);
  260. }
  261. div.sidebar-bottom {
  262. padding-left: 0.5rem;
  263. padding-right: 0.5rem;
  264. position: sticky;
  265. height: 8rem;
  266. background-color: var(--nbx-sidebar-bg);
  267. box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.1);
  268. .nav-link {
  269. padding: 0.5rem 0.25rem;
  270. }
  271. }
  272. a.sidebar-logo {
  273. display: flex;
  274. flex-shrink: 1;
  275. width: 100%;
  276. height: 4rem;
  277. }
  278. }
  279. .tooltip {
  280. pointer-events: none;
  281. }
  282. .ws-nowrap {
  283. white-space: nowrap !important;
  284. }
  285. #object-type-selector {
  286. button.dropdown-item,
  287. h6.dropdown-header {
  288. font-size: $font-size-sm;
  289. }
  290. }
  291. .stats-container {
  292. min-height: 50vh;
  293. }
  294. span.color-label {
  295. width: 5rem;
  296. height: 1rem;
  297. display: block;
  298. box-shadow: $box-shadow-sm;
  299. border-radius: $border-radius;
  300. padding: $badge-padding-y $badge-padding-x;
  301. }
  302. pre {
  303. border-radius: $border-radius;
  304. border: 1px solid var(--nbx-pre-border-color);
  305. background-color: var(--nbx-pre-bg);
  306. padding: $spacer;
  307. white-space: pre;
  308. }
  309. .btn {
  310. white-space: nowrap;
  311. }
  312. .card {
  313. box-shadow: $box-shadow-sm;
  314. .card-header {
  315. color: $body-color;
  316. border-bottom: none;
  317. padding: $card-cap-padding-x;
  318. }
  319. .card-header + .card-body {
  320. padding-top: 0;
  321. }
  322. .card-body {
  323. overflow-x: auto;
  324. }
  325. }
  326. .form-floating {
  327. position: relative;
  328. > .input-group > .form-control,
  329. > .input-group > .form-select {
  330. height: $form-floating-height;
  331. padding: $form-floating-padding-y $form-floating-padding-x;
  332. }
  333. > .input-group > label {
  334. position: absolute;
  335. top: 0;
  336. left: 0;
  337. height: 100%; // allow textareas
  338. padding: $form-floating-padding-y $form-floating-padding-x;
  339. pointer-events: none;
  340. border: $input-border-width solid transparent; // Required for aligning label's text with the input as it affects inner box model
  341. transform-origin: 0 0;
  342. @include transition($form-floating-transition);
  343. }
  344. > .input-group > .form-control {
  345. &::placeholder {
  346. color: transparent;
  347. }
  348. &:focus,
  349. &:not(:placeholder-shown) {
  350. padding-top: $form-floating-input-padding-t;
  351. padding-bottom: $form-floating-input-padding-b;
  352. }
  353. // Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
  354. &:-webkit-autofill {
  355. padding-top: $form-floating-input-padding-t;
  356. padding-bottom: $form-floating-input-padding-b;
  357. }
  358. }
  359. > .input-group > .form-select,
  360. > .choices > .choices__inner,
  361. > .ss-main span.placeholder, // SlimSelect Single
  362. > .ss-main div.ss-values // SlimSelect Multiple
  363. {
  364. padding-top: $form-floating-input-padding-t;
  365. padding-bottom: $form-floating-input-padding-b;
  366. }
  367. > .input-group > .form-control:focus,
  368. > .input-group > .form-control:not(:placeholder-shown),
  369. > .input-group > .form-select,
  370. > .choices,
  371. > .ss-main {
  372. ~ label {
  373. opacity: $form-floating-label-opacity;
  374. transform: $form-floating-label-transform;
  375. z-index: 4;
  376. }
  377. }
  378. // Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
  379. > .input-group > .form-control:-webkit-autofill {
  380. ~ label {
  381. opacity: $form-floating-label-opacity;
  382. transform: $form-floating-label-transform;
  383. z-index: 4;
  384. }
  385. }
  386. }
  387. textarea#id_local_context_data,
  388. textarea.markdown,
  389. textarea#id_public_key {
  390. font-family: $font-family-monospace;
  391. }
  392. textarea.form-control[name='csv'] {
  393. font-family: $font-family-monospace;
  394. }
  395. table tr.vertical-align {
  396. vertical-align: middle;
  397. }
  398. .card:not(:only-of-type) {
  399. margin-bottom: $spacer;
  400. }
  401. .stat-btn {
  402. min-width: $spacer * 3;
  403. }
  404. nav.breadcrumb-container {
  405. padding: $badge-padding-y $badge-padding-x;
  406. border-radius: $border-radius;
  407. font-size: $font-size-sm;
  408. width: fit-content;
  409. background-color: var(--nbx-breadcrumb-bg);
  410. margin-top: $spacer;
  411. margin-bottom: $spacer;
  412. ol.breadcrumb {
  413. margin-bottom: 0;
  414. li.breadcrumb-item > a {
  415. text-decoration: none;
  416. }
  417. li.breadcrumb-item > a:hover {
  418. text-decoration: underline;
  419. }
  420. }
  421. }
  422. div.paginator > form > div.input-group {
  423. width: fit-content;
  424. }
  425. div.field-group:not(:first-of-type) {
  426. margin-top: $spacer * 3;
  427. h1,
  428. h2,
  429. h3,
  430. h4,
  431. h5,
  432. h6 {
  433. margin-bottom: $spacer;
  434. }
  435. }
  436. label.required {
  437. font-weight: $font-weight-bold;
  438. &::after {
  439. font-family: 'Material Design Icons';
  440. content: '\f06C4';
  441. font-weight: normal;
  442. font-size: 8px;
  443. font-style: normal;
  444. margin: 0 0 0 2px;
  445. text-decoration: none;
  446. display: inline-block;
  447. position: absolute;
  448. }
  449. }
  450. div.bulk-buttons {
  451. display: flex;
  452. & > * {
  453. margin: $spacer / 4;
  454. }
  455. }
  456. i.bi-plus:before,
  457. span.bi-plus:before {
  458. font-weight: $font-weight-bold !important;
  459. }
  460. table tbody {
  461. @each $color, $value in $theme-colors {
  462. tr.#{$color} {
  463. background-color: rgba($value, 0.15);
  464. border-color: $gray-500;
  465. }
  466. }
  467. }
  468. // Cable Tracing
  469. .cable-trace {
  470. max-width: 38rem;
  471. margin: 1rem auto;
  472. text-align: center;
  473. }
  474. .cable-trace .node {
  475. background-color: var(--nbx-cable-node-bg);
  476. border: $border-width solid var(--nbx-cable-node-border-color);
  477. border-radius: $border-radius;
  478. padding: 1.5rem 1rem;
  479. position: relative;
  480. z-index: 1;
  481. }
  482. .cable-trace .termination {
  483. background-color: var(--nbx-cable-termination-bg);
  484. border: $border-width solid var(--nbx-cable-termination-border-color);
  485. box-shadow: $box-shadow;
  486. border-radius: $border-radius;
  487. margin: -1rem auto;
  488. padding: 0.5rem;
  489. position: relative;
  490. width: 60%;
  491. z-index: 2;
  492. }
  493. .cable-trace .active {
  494. border: 0.25rem solid $success;
  495. }
  496. .cable-trace .cable {
  497. border-left-style: solid;
  498. border-left-width: 0.25rem;
  499. margin: 1rem 0 1rem 50%;
  500. padding: 1.5rem;
  501. text-align: left;
  502. width: 50%;
  503. }
  504. .cable-trace .trace-end {
  505. margin-top: 2rem;
  506. text-align: center;
  507. }
  508. pre.change-data {
  509. padding-left: 0;
  510. padding-right: 0;
  511. & > span {
  512. display: block;
  513. padding-left: $spacer;
  514. padding-right: $spacer;
  515. &.added {
  516. background-color: var(--nbx-change-added);
  517. }
  518. &.removed {
  519. background-color: var(--nbx-change-removed);
  520. }
  521. }
  522. }
  523. pre.change-diff {
  524. border-color: transparent;
  525. &.change-removed {
  526. background-color: var(--nbx-change-removed);
  527. }
  528. &.change-added {
  529. background-color: var(--nbx-change-added);
  530. }
  531. }
  532. div.card-overlay {
  533. position: absolute;
  534. width: 100%;
  535. height: 100%;
  536. background-color: rgba($white, 0.75);
  537. border-radius: $border-radius;
  538. display: flex;
  539. justify-content: center;
  540. align-items: center;
  541. & > div.spinner-border {
  542. width: 6rem;
  543. height: 6rem;
  544. color: $secondary;
  545. }
  546. }
  547. div.card > div.card-header > div.table-controls {
  548. max-width: 25%;
  549. width: 100%;
  550. }