netbox.scss 14 KB

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