_theming.scss 141 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067
  1. // Import all the theming functionality.
  2. // We can use relative imports for imports from the cdk because we bundle everything
  3. // up into a single flat scss file for material.
  4. // We want overlays to always appear over user content, so set a baseline
  5. // very high z-index for the overlay container, which is where we create the new
  6. // stacking context for all overlays.
  7. $cdk-z-index-overlay-container: 1000 !default;
  8. $cdk-z-index-overlay: 1000 !default;
  9. $cdk-z-index-overlay-backdrop: 1000 !default;
  10. // Background color for all of the backdrops
  11. $cdk-overlay-dark-backdrop-background: rgba(0, 0, 0, 0.32) !default;
  12. // Default backdrop animation is based on the Material Design swift-ease-out.
  13. $backdrop-animation-duration: 400ms !default;
  14. $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
  15. @mixin cdk-overlay() {
  16. .cdk-overlay-container, .cdk-global-overlay-wrapper {
  17. // Disable events from being captured on the overlay container.
  18. pointer-events: none;
  19. // The container should be the size of the viewport.
  20. top: 0;
  21. left: 0;
  22. height: 100%;
  23. width: 100%;
  24. }
  25. // The overlay-container is an invisible element which contains all individual overlays.
  26. .cdk-overlay-container {
  27. position: fixed;
  28. z-index: $cdk-z-index-overlay-container;
  29. &:empty {
  30. // Hide the element when it doesn't have any child nodes. This doesn't
  31. // include overlays that have been detached, rather than disposed.
  32. display: none;
  33. }
  34. }
  35. // We use an extra wrapper element in order to use make the overlay itself a flex item.
  36. // This makes centering the overlay easy without running into the subpixel rendering
  37. // problems tied to using `transform` and without interfering with the other position
  38. // strategies.
  39. .cdk-global-overlay-wrapper {
  40. display: flex;
  41. position: absolute;
  42. z-index: $cdk-z-index-overlay;
  43. }
  44. // A single overlay pane.
  45. .cdk-overlay-pane {
  46. // Note: it's important for this one to start off `absolute`,
  47. // in order for us to be able to measure it correctly.
  48. position: absolute;
  49. pointer-events: auto;
  50. box-sizing: border-box;
  51. z-index: $cdk-z-index-overlay;
  52. // For connected-position overlays, we set `display: flex` in
  53. // order to force `max-width` and `max-height` to take effect.
  54. display: flex;
  55. max-width: 100%;
  56. max-height: 100%;
  57. }
  58. .cdk-overlay-backdrop {
  59. // TODO(jelbourn): reuse sidenav fullscreen mixin.
  60. position: absolute;
  61. top: 0;
  62. bottom: 0;
  63. left: 0;
  64. right: 0;
  65. z-index: $cdk-z-index-overlay-backdrop;
  66. pointer-events: auto;
  67. -webkit-tap-highlight-color: transparent;
  68. transition: opacity $backdrop-animation-duration $backdrop-animation-timing-function;
  69. opacity: 0;
  70. &.cdk-overlay-backdrop-showing {
  71. opacity: 1;
  72. // In high contrast mode the rgba background will become solid so we need to fall back
  73. // to making it opaque using `opacity`. Note that we can't use the `cdk-high-contrast`
  74. // mixin, because we can't normalize the import path to the _a11y.scss both for the
  75. // source and when this file is distributed. See #10908.
  76. @media screen and (-ms-high-contrast: active) {
  77. opacity: 0.6;
  78. }
  79. }
  80. }
  81. .cdk-overlay-dark-backdrop {
  82. background: $cdk-overlay-dark-backdrop-background;
  83. }
  84. .cdk-overlay-transparent-backdrop {
  85. // Note: as of Firefox 57, having the backdrop be `background: none` will prevent it from
  86. // capturing the user's mouse scroll events. Since we also can't use something like
  87. // `rgba(0, 0, 0, 0)`, we work around the inconsistency by not setting the background at
  88. // all and using `opacity` to make the element transparent.
  89. &, &.cdk-overlay-backdrop-showing {
  90. opacity: 0;
  91. }
  92. }
  93. // Overlay parent element used with the connected position strategy. Used to constrain the
  94. // overlay element's size to fit within the viewport.
  95. .cdk-overlay-connected-position-bounding-box {
  96. position: absolute;
  97. z-index: $cdk-z-index-overlay;
  98. // We use `display: flex` on this element exclusively for centering connected overlays.
  99. // When *not* centering, a top/left/bottom/right will be set which overrides the normal
  100. // flex layout.
  101. display: flex;
  102. // We use the `column` direction here to avoid some flexbox issues in Edge
  103. // when using the "grow after open" options.
  104. flex-direction: column;
  105. // Add some dimensions so the element has an `innerText` which some people depend on in tests.
  106. min-width: 1px;
  107. min-height: 1px;
  108. }
  109. // Used when disabling global scrolling.
  110. .cdk-global-scrollblock {
  111. position: fixed;
  112. // Necessary for the content not to lose its width. Note that we're using 100%, instead of
  113. // 100vw, because 100vw includes the width plus the scrollbar, whereas 100% is the width
  114. // that the element had before we made it `fixed`.
  115. width: 100%;
  116. // Note: this will always add a scrollbar to whatever element it is on, which can
  117. // potentially result in double scrollbars. It shouldn't be an issue, because we won't
  118. // block scrolling on a page that doesn't have a scrollbar in the first place.
  119. overflow-y: scroll;
  120. }
  121. }
  122. @mixin cdk-a11y {
  123. .cdk-visually-hidden {
  124. border: 0;
  125. clip: rect(0 0 0 0);
  126. height: 1px;
  127. margin: -1px;
  128. overflow: hidden;
  129. padding: 0;
  130. position: absolute;
  131. width: 1px;
  132. // Avoid browsers rendering the focus ring in some cases.
  133. outline: 0;
  134. // Avoid some cases where the browser will still render the native controls (see #9049).
  135. -webkit-appearance: none;
  136. -moz-appearance: none;
  137. }
  138. }
  139. // Applies styles for users in high contrast mode. Note that this only applies
  140. // to Microsoft browsers. Chrome can be included by checking for the `html[hc]`
  141. // attribute, however Chrome handles high contrast differently.
  142. //
  143. // @param target Which kind of high contrast setting to target. Defaults to `active`, can be
  144. // `white-on-black` or `black-on-white`.
  145. @mixin cdk-high-contrast($target: active) {
  146. @media (-ms-high-contrast: $target) {
  147. @content;
  148. }
  149. }
  150. // Core styles that enable monitoring autofill state of text fields.
  151. @mixin cdk-text-field {
  152. // Keyframes that apply no styles, but allow us to monitor when an text field becomes autofilled
  153. // by watching for the animation events that are fired when they start. Note: the /*!*/ comment is
  154. // needed to prevent LibSass from stripping the keyframes out.
  155. // Based on: https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7
  156. @keyframes cdk-text-field-autofill-start {/*!*/}
  157. @keyframes cdk-text-field-autofill-end {/*!*/}
  158. .cdk-text-field-autofill-monitored:-webkit-autofill {
  159. animation-name: cdk-text-field-autofill-start;
  160. }
  161. .cdk-text-field-autofill-monitored:not(:-webkit-autofill) {
  162. animation-name: cdk-text-field-autofill-end;
  163. }
  164. // Remove the resize handle on autosizing textareas, because whatever height
  165. // the user resized to will be overwritten once they start typing again.
  166. textarea.cdk-textarea-autosize {
  167. resize: none;
  168. }
  169. // This class is temporarily applied to the textarea when it is being measured. It is immediately
  170. // removed when measuring is complete. We use `!important` rules here to make sure user-specified
  171. // rules do not interfere with the measurement.
  172. textarea.cdk-textarea-autosize-measuring {
  173. height: auto !important;
  174. overflow: hidden !important;
  175. // Having 2px top and bottom padding seems to fix a bug where Chrome gets an incorrect
  176. // measurement. We just have to account for it later and subtract it off the final result.
  177. padding: 2px 0 !important;
  178. box-sizing: content-box !important;
  179. }
  180. }
  181. // Used to generate UIDs for keyframes used to change the text field autofill styles.
  182. $cdk-text-field-autofill-color-frame-count: 0;
  183. // Mixin used to apply custom background and foreground colors to an autofilled text field.
  184. // Based on: https://stackoverflow.com/questions/2781549/
  185. // removing-input-background-colour-for-chrome-autocomplete#answer-37432260
  186. @mixin cdk-text-field-autofill-color($background, $foreground:'') {
  187. @keyframes cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count} {
  188. to {
  189. background: $background;
  190. @if $foreground != '' { color: $foreground; }
  191. }
  192. }
  193. &:-webkit-autofill {
  194. animation-name: cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count};
  195. animation-fill-mode: both;
  196. }
  197. &.cdk-text-field-autofill-monitored:-webkit-autofill {
  198. animation-name: cdk-text-field-autofill-start,
  199. cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count};
  200. }
  201. $cdk-text-field-autofill-color-frame-count:
  202. $cdk-text-field-autofill-color-frame-count + 1 !global;
  203. }
  204. // Core styles that can be used to apply material design treatments to any element.
  205. // Media queries
  206. // TODO(josephperrott): Change $mat-xsmall and $mat-small usages to rely on BreakpointObserver,
  207. $mat-xsmall: 'max-width: 599px';
  208. $mat-small: 'max-width: 959px';
  209. // TODO: Revisit all z-indices before beta
  210. // z-index master list
  211. $z-index-fab: 20 !default;
  212. $z-index-drawer: 100 !default;
  213. // Global constants
  214. $pi: 3.14159265;
  215. // Padding between input toggles and their labels
  216. $mat-toggle-padding: 8px !default;
  217. // Width and height of input toggles
  218. $mat-toggle-size: 20px !default;
  219. // Easing Curves
  220. // TODO(jelbourn): all of these need to be revisited
  221. // The default animation curves used by material design.
  222. $mat-linear-out-slow-in-timing-function: cubic-bezier(0, 0, 0.2, 0.1) !default;
  223. $mat-fast-out-slow-in-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !default;
  224. $mat-fast-out-linear-in-timing-function: cubic-bezier(0.4, 0, 1, 1) !default;
  225. $ease-in-out-curve-function: cubic-bezier(0.35, 0, 0.25, 1) !default;
  226. $swift-ease-out-duration: 400ms !default;
  227. $swift-ease-out-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
  228. $swift-ease-out: all $swift-ease-out-duration $swift-ease-out-timing-function !default;
  229. $swift-ease-in-duration: 300ms !default;
  230. $swift-ease-in-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2) !default;
  231. $swift-ease-in: all $swift-ease-in-duration $swift-ease-in-timing-function !default;
  232. $swift-ease-in-out-duration: 500ms !default;
  233. $swift-ease-in-out-timing-function: $ease-in-out-curve-function !default;
  234. $swift-ease-in-out: all $swift-ease-in-out-duration $swift-ease-in-out-timing-function !default;
  235. $swift-linear-duration: 80ms !default;
  236. $swift-linear-timing-function: linear !default;
  237. $swift-linear: all $swift-linear-duration $swift-linear-timing-function !default;
  238. // A collection of mixins and CSS classes that can be used to apply elevation to a material
  239. // element.
  240. // See: https://material.io/design/environment/elevation.html
  241. // Examples:
  242. //
  243. //
  244. // .mat-foo {
  245. // @include $mat-elevation(2);
  246. //
  247. // &:active {
  248. // @include $mat-elevation(8);
  249. // }
  250. // }
  251. //
  252. // <div id="external-card" class="mat-elevation-z2"><p>Some content</p></div>
  253. //
  254. // For an explanation of the design behind how elevation is implemented, see the design doc at
  255. // https://goo.gl/Kq0k9Z.
  256. // Colors for umbra, penumbra, and ambient shadows. As described in the design doc, each elevation
  257. // level is created using a set of 3 shadow values, one for umbra (the shadow representing the
  258. // space completely obscured by an object relative to its light source), one for penumbra (the
  259. // space partially obscured by an object), and one for ambient (the space which contains the object
  260. // itself). For a further explanation of these terms and their meanings, see
  261. // https://en.wikipedia.org/wiki/Umbra,_penumbra_and_antumbra.
  262. // Maps for the different shadow sets and their values within each z-space. These values were
  263. // created by taking a few reference shadow sets created by Google's Designers and interpolating
  264. // all of the values between them.
  265. @function _get-umbra-map($color, $opacity) {
  266. $shadow-color: if(type-of($color) == color, rgba($color, $opacity * 0.2), $color);
  267. @return (
  268. 0: '0px 0px 0px 0px #{$shadow-color}',
  269. 1: '0px 2px 1px -1px #{$shadow-color}',
  270. 2: '0px 3px 1px -2px #{$shadow-color}',
  271. 3: '0px 3px 3px -2px #{$shadow-color}',
  272. 4: '0px 2px 4px -1px #{$shadow-color}',
  273. 5: '0px 3px 5px -1px #{$shadow-color}',
  274. 6: '0px 3px 5px -1px #{$shadow-color}',
  275. 7: '0px 4px 5px -2px #{$shadow-color}',
  276. 8: '0px 5px 5px -3px #{$shadow-color}',
  277. 9: '0px 5px 6px -3px #{$shadow-color}',
  278. 10: '0px 6px 6px -3px #{$shadow-color}',
  279. 11: '0px 6px 7px -4px #{$shadow-color}',
  280. 12: '0px 7px 8px -4px #{$shadow-color}',
  281. 13: '0px 7px 8px -4px #{$shadow-color}',
  282. 14: '0px 7px 9px -4px #{$shadow-color}',
  283. 15: '0px 8px 9px -5px #{$shadow-color}',
  284. 16: '0px 8px 10px -5px #{$shadow-color}',
  285. 17: '0px 8px 11px -5px #{$shadow-color}',
  286. 18: '0px 9px 11px -5px #{$shadow-color}',
  287. 19: '0px 9px 12px -6px #{$shadow-color}',
  288. 20: '0px 10px 13px -6px #{$shadow-color}',
  289. 21: '0px 10px 13px -6px #{$shadow-color}',
  290. 22: '0px 10px 14px -6px #{$shadow-color}',
  291. 23: '0px 11px 14px -7px #{$shadow-color}',
  292. 24: '0px 11px 15px -7px #{$shadow-color}'
  293. );
  294. }
  295. @function _get-penumbra-map($color, $opacity) {
  296. $shadow-color: if(type-of($color) == color, rgba($color, $opacity * 0.14), $color);
  297. @return (
  298. 0: '0px 0px 0px 0px #{$shadow-color}',
  299. 1: '0px 1px 1px 0px #{$shadow-color}',
  300. 2: '0px 2px 2px 0px #{$shadow-color}',
  301. 3: '0px 3px 4px 0px #{$shadow-color}',
  302. 4: '0px 4px 5px 0px #{$shadow-color}',
  303. 5: '0px 5px 8px 0px #{$shadow-color}',
  304. 6: '0px 6px 10px 0px #{$shadow-color}',
  305. 7: '0px 7px 10px 1px #{$shadow-color}',
  306. 8: '0px 8px 10px 1px #{$shadow-color}',
  307. 9: '0px 9px 12px 1px #{$shadow-color}',
  308. 10: '0px 10px 14px 1px #{$shadow-color}',
  309. 11: '0px 11px 15px 1px #{$shadow-color}',
  310. 12: '0px 12px 17px 2px #{$shadow-color}',
  311. 13: '0px 13px 19px 2px #{$shadow-color}',
  312. 14: '0px 14px 21px 2px #{$shadow-color}',
  313. 15: '0px 15px 22px 2px #{$shadow-color}',
  314. 16: '0px 16px 24px 2px #{$shadow-color}',
  315. 17: '0px 17px 26px 2px #{$shadow-color}',
  316. 18: '0px 18px 28px 2px #{$shadow-color}',
  317. 19: '0px 19px 29px 2px #{$shadow-color}',
  318. 20: '0px 20px 31px 3px #{$shadow-color}',
  319. 21: '0px 21px 33px 3px #{$shadow-color}',
  320. 22: '0px 22px 35px 3px #{$shadow-color}',
  321. 23: '0px 23px 36px 3px #{$shadow-color}',
  322. 24: '0px 24px 38px 3px #{$shadow-color}'
  323. );
  324. }
  325. @function _get-ambient-map($color, $opacity) {
  326. $shadow-color: if(type-of($color) == color, rgba($color, $opacity * 0.12), $color);
  327. @return (
  328. 0: '0px 0px 0px 0px #{$shadow-color}',
  329. 1: '0px 1px 3px 0px #{$shadow-color}',
  330. 2: '0px 1px 5px 0px #{$shadow-color}',
  331. 3: '0px 1px 8px 0px #{$shadow-color}',
  332. 4: '0px 1px 10px 0px #{$shadow-color}',
  333. 5: '0px 1px 14px 0px #{$shadow-color}',
  334. 6: '0px 1px 18px 0px #{$shadow-color}',
  335. 7: '0px 2px 16px 1px #{$shadow-color}',
  336. 8: '0px 3px 14px 2px #{$shadow-color}',
  337. 9: '0px 3px 16px 2px #{$shadow-color}',
  338. 10: '0px 4px 18px 3px #{$shadow-color}',
  339. 11: '0px 4px 20px 3px #{$shadow-color}',
  340. 12: '0px 5px 22px 4px #{$shadow-color}',
  341. 13: '0px 5px 24px 4px #{$shadow-color}',
  342. 14: '0px 5px 26px 4px #{$shadow-color}',
  343. 15: '0px 6px 28px 5px #{$shadow-color}',
  344. 16: '0px 6px 30px 5px #{$shadow-color}',
  345. 17: '0px 6px 32px 5px #{$shadow-color}',
  346. 18: '0px 7px 34px 6px #{$shadow-color}',
  347. 19: '0px 7px 36px 6px #{$shadow-color}',
  348. 20: '0px 8px 38px 7px #{$shadow-color}',
  349. 21: '0px 8px 40px 7px #{$shadow-color}',
  350. 22: '0px 8px 42px 7px #{$shadow-color}',
  351. 23: '0px 9px 44px 8px #{$shadow-color}',
  352. 24: '0px 9px 46px 8px #{$shadow-color}'
  353. );
  354. }
  355. // The default duration value for elevation transitions.
  356. $mat-elevation-transition-duration: 280ms !default;
  357. // The default easing value for elevation transitions.
  358. $mat-elevation-transition-timing-function: $mat-fast-out-slow-in-timing-function;
  359. // The default color for elevation shadows.
  360. $mat-elevation-color: black !default;
  361. // The default opacity scaling value for elevation shadows.
  362. $mat-elevation-opacity: 1 !default;
  363. // Prefix for elevation-related selectors.
  364. $_mat-elevation-prefix: 'mat-elevation-z';
  365. // Applies the correct css rules to an element to give it the elevation specified by $zValue.
  366. // The $zValue must be between 0 and 24.
  367. @mixin mat-elevation($zValue, $color: $mat-elevation-color, $opacity: $mat-elevation-opacity) {
  368. @if type-of($zValue) != number or not unitless($zValue) {
  369. @error '$zValue must be a unitless number';
  370. }
  371. @if $zValue < 0 or $zValue > 24 {
  372. @error '$zValue must be between 0 and 24';
  373. }
  374. box-shadow: #{map-get(_get-umbra-map($color, $opacity), $zValue)},
  375. #{map-get(_get-penumbra-map($color, $opacity), $zValue)},
  376. #{map-get(_get-ambient-map($color, $opacity), $zValue)};
  377. }
  378. @mixin _mat-theme-elevation($zValue, $theme, $opacity: $mat-elevation-opacity) {
  379. $foreground: map-get($theme, foreground);
  380. $elevation-color: map-get($foreground, elevation);
  381. $elevation-color-or-default: if($elevation-color == null, $mat-elevation-color, $elevation-color);
  382. @include mat-elevation($zValue, $elevation-color-or-default, $opacity);
  383. }
  384. // Applies the elevation to an element in a manner that allows
  385. // consumers to override it via the Material elevation classes.
  386. @mixin mat-overridable-elevation(
  387. $zValue,
  388. $color: $mat-elevation-color,
  389. $opacity: $mat-elevation-opacity) {
  390. &:not([class*='#{$_mat-elevation-prefix}']) {
  391. @include mat-elevation($zValue, $color, $opacity);
  392. }
  393. }
  394. @mixin _mat-theme-overridable-elevation($zValue, $theme, $opacity: $mat-elevation-opacity) {
  395. $foreground: map-get($theme, foreground);
  396. $elevation-color: map-get($foreground, elevation);
  397. $elevation-color-or-default: if($elevation-color == null, $mat-elevation-color, $elevation-color);
  398. @include mat-overridable-elevation($zValue, $elevation-color-or-default, $opacity);
  399. }
  400. // Returns a string that can be used as the value for a transition property for elevation.
  401. // Calling this function directly is useful in situations where a component needs to transition
  402. // more than one property.
  403. //
  404. // .foo {
  405. // transition: mat-elevation-transition-property-value(), opacity 100ms ease;
  406. // }
  407. @function mat-elevation-transition-property-value(
  408. $duration: $mat-elevation-transition-duration,
  409. $easing: $mat-elevation-transition-timing-function) {
  410. @return box-shadow #{$duration} #{$easing};
  411. }
  412. // Applies the correct css rules needed to have an element transition between elevations.
  413. // This mixin should be applied to elements whose elevation values will change depending on their
  414. // context (e.g. when active or disabled).
  415. //
  416. // NOTE(traviskaufman): Both this mixin and the above function use default parameters so they can
  417. // be used in the same way by clients.
  418. @mixin mat-elevation-transition(
  419. $duration: $mat-elevation-transition-duration,
  420. $easing: $mat-elevation-transition-timing-function) {
  421. transition: mat-elevation-transition-property-value($duration, $easing);
  422. }
  423. // Color palettes from the Material Design spec.
  424. // See https://material.io/design/color/
  425. //
  426. // Contrast colors are hard-coded because it is too difficult (probably impossible) to
  427. // calculate them. These contrast colors are pulled from the public Material Design spec swatches.
  428. // While the contrast colors in the spec are not prescriptive, we use them for convenience.
  429. // @deprecated renamed to $dark-primary-text.
  430. // @breaking-change 8.0.0
  431. $black-87-opacity: rgba(black, 0.87);
  432. // @deprecated renamed to $light-primary-text.
  433. // @breaking-change 8.0.0
  434. $white-87-opacity: rgba(white, 0.87);
  435. // @deprecated use $dark-[secondary-text,disabled-text,dividers,focused] instead.
  436. // @breaking-change 8.0.0
  437. $black-12-opacity: rgba(black, 0.12);
  438. // @deprecated use $light-[secondary-text,disabled-text,dividers,focused] instead.
  439. // @breaking-change 8.0.0
  440. $white-12-opacity: rgba(white, 0.12);
  441. // @deprecated use $dark-[secondary-text,disabled-text,dividers,focused] instead.
  442. // @breaking-change 8.0.0
  443. $black-6-opacity: rgba(black, 0.06);
  444. // @deprecated use $light-[secondary-text,disabled-text,dividers,focused] instead.
  445. // @breaking-change 8.0.0
  446. $white-6-opacity: rgba(white, 0.06);
  447. $dark-primary-text: rgba(black, 0.87);
  448. $dark-secondary-text: rgba(black, 0.54);
  449. $dark-disabled-text: rgba(black, 0.38);
  450. $dark-dividers: rgba(black, 0.12);
  451. $dark-focused: rgba(black, 0.12);
  452. $light-primary-text: white;
  453. $light-secondary-text: rgba(white, 0.7);
  454. $light-disabled-text: rgba(white, 0.5);
  455. $light-dividers: rgba(white, 0.12);
  456. $light-focused: rgba(white, 0.12);
  457. $mat-red: (
  458. 50: #ffebee,
  459. 100: #ffcdd2,
  460. 200: #ef9a9a,
  461. 300: #e57373,
  462. 400: #ef5350,
  463. 500: #f44336,
  464. 600: #e53935,
  465. 700: #d32f2f,
  466. 800: #c62828,
  467. 900: #b71c1c,
  468. A100: #ff8a80,
  469. A200: #ff5252,
  470. A400: #ff1744,
  471. A700: #d50000,
  472. contrast: (
  473. 50: $dark-primary-text,
  474. 100: $dark-primary-text,
  475. 200: $dark-primary-text,
  476. 300: $dark-primary-text,
  477. 400: $dark-primary-text,
  478. 500: $light-primary-text,
  479. 600: $light-primary-text,
  480. 700: $light-primary-text,
  481. 800: $light-primary-text,
  482. 900: $light-primary-text,
  483. A100: $dark-primary-text,
  484. A200: $light-primary-text,
  485. A400: $light-primary-text,
  486. A700: $light-primary-text,
  487. )
  488. );
  489. $mat-pink: (
  490. 50: #fce4ec,
  491. 100: #f8bbd0,
  492. 200: #f48fb1,
  493. 300: #f06292,
  494. 400: #ec407a,
  495. 500: #e91e63,
  496. 600: #d81b60,
  497. 700: #c2185b,
  498. 800: #ad1457,
  499. 900: #880e4f,
  500. A100: #ff80ab,
  501. A200: #ff4081,
  502. A400: #f50057,
  503. A700: #c51162,
  504. contrast: (
  505. 50: $dark-primary-text,
  506. 100: $dark-primary-text,
  507. 200: $dark-primary-text,
  508. 300: $dark-primary-text,
  509. 400: $dark-primary-text,
  510. 500: $light-primary-text,
  511. 600: $light-primary-text,
  512. 700: $light-primary-text,
  513. 800: $light-primary-text,
  514. 900: $light-primary-text,
  515. A100: $dark-primary-text,
  516. A200: $light-primary-text,
  517. A400: $light-primary-text,
  518. A700: $light-primary-text,
  519. )
  520. );
  521. $mat-purple: (
  522. 50: #f3e5f5,
  523. 100: #e1bee7,
  524. 200: #ce93d8,
  525. 300: #ba68c8,
  526. 400: #ab47bc,
  527. 500: #9c27b0,
  528. 600: #8e24aa,
  529. 700: #7b1fa2,
  530. 800: #6a1b9a,
  531. 900: #4a148c,
  532. A100: #ea80fc,
  533. A200: #e040fb,
  534. A400: #d500f9,
  535. A700: #aa00ff,
  536. contrast: (
  537. 50: $dark-primary-text,
  538. 100: $dark-primary-text,
  539. 200: $dark-primary-text,
  540. 300: $light-primary-text,
  541. 400: $light-primary-text,
  542. 500: $light-primary-text,
  543. 600: $light-primary-text,
  544. 700: $light-primary-text,
  545. 800: $light-primary-text,
  546. 900: $light-primary-text,
  547. A100: $dark-primary-text,
  548. A200: $light-primary-text,
  549. A400: $light-primary-text,
  550. A700: $light-primary-text,
  551. )
  552. );
  553. $mat-deep-purple: (
  554. 50: #ede7f6,
  555. 100: #d1c4e9,
  556. 200: #b39ddb,
  557. 300: #9575cd,
  558. 400: #7e57c2,
  559. 500: #673ab7,
  560. 600: #5e35b1,
  561. 700: #512da8,
  562. 800: #4527a0,
  563. 900: #311b92,
  564. A100: #b388ff,
  565. A200: #7c4dff,
  566. A400: #651fff,
  567. A700: #6200ea,
  568. contrast: (
  569. 50: $dark-primary-text,
  570. 100: $dark-primary-text,
  571. 200: $dark-primary-text,
  572. 300: $light-primary-text,
  573. 400: $light-primary-text,
  574. 500: $light-primary-text,
  575. 600: $light-primary-text,
  576. 700: $light-primary-text,
  577. 800: $light-primary-text,
  578. 900: $light-primary-text,
  579. A100: $dark-primary-text,
  580. A200: $light-primary-text,
  581. A400: $light-primary-text,
  582. A700: $light-primary-text,
  583. )
  584. );
  585. $mat-indigo: (
  586. 50: #e8eaf6,
  587. 100: #c5cae9,
  588. 200: #9fa8da,
  589. 300: #7986cb,
  590. 400: #5c6bc0,
  591. 500: #3f51b5,
  592. 600: #3949ab,
  593. 700: #303f9f,
  594. 800: #283593,
  595. 900: #1a237e,
  596. A100: #8c9eff,
  597. A200: #536dfe,
  598. A400: #3d5afe,
  599. A700: #304ffe,
  600. contrast: (
  601. 50: $dark-primary-text,
  602. 100: $dark-primary-text,
  603. 200: $dark-primary-text,
  604. 300: $light-primary-text,
  605. 400: $light-primary-text,
  606. 500: $light-primary-text,
  607. 600: $light-primary-text,
  608. 700: $light-primary-text,
  609. 800: $light-primary-text,
  610. 900: $light-primary-text,
  611. A100: $dark-primary-text,
  612. A200: $light-primary-text,
  613. A400: $light-primary-text,
  614. A700: $light-primary-text,
  615. )
  616. );
  617. $mat-blue: (
  618. 50: #e3f2fd,
  619. 100: #bbdefb,
  620. 200: #90caf9,
  621. 300: #64b5f6,
  622. 400: #42a5f5,
  623. 500: #2196f3,
  624. 600: #1e88e5,
  625. 700: #1976d2,
  626. 800: #1565c0,
  627. 900: #0d47a1,
  628. A100: #82b1ff,
  629. A200: #448aff,
  630. A400: #2979ff,
  631. A700: #2962ff,
  632. contrast: (
  633. 50: $dark-primary-text,
  634. 100: $dark-primary-text,
  635. 200: $dark-primary-text,
  636. 300: $dark-primary-text,
  637. 400: $dark-primary-text,
  638. 500: $light-primary-text,
  639. 600: $light-primary-text,
  640. 700: $light-primary-text,
  641. 800: $light-primary-text,
  642. 900: $light-primary-text,
  643. A100: $dark-primary-text,
  644. A200: $light-primary-text,
  645. A400: $light-primary-text,
  646. A700: $light-primary-text,
  647. )
  648. );
  649. $mat-light-blue: (
  650. 50: #e1f5fe,
  651. 100: #b3e5fc,
  652. 200: #81d4fa,
  653. 300: #4fc3f7,
  654. 400: #29b6f6,
  655. 500: #03a9f4,
  656. 600: #039be5,
  657. 700: #0288d1,
  658. 800: #0277bd,
  659. 900: #01579b,
  660. A100: #80d8ff,
  661. A200: #40c4ff,
  662. A400: #00b0ff,
  663. A700: #0091ea,
  664. contrast: (
  665. 50: $dark-primary-text,
  666. 100: $dark-primary-text,
  667. 200: $dark-primary-text,
  668. 300: $dark-primary-text,
  669. 400: $dark-primary-text,
  670. 500: $light-primary-text,
  671. 600: $light-primary-text,
  672. 700: $light-primary-text,
  673. 800: $light-primary-text,
  674. 900: $light-primary-text,
  675. A100: $dark-primary-text,
  676. A200: $dark-primary-text,
  677. A400: $dark-primary-text,
  678. A700: $light-primary-text,
  679. )
  680. );
  681. $mat-cyan: (
  682. 50: #e0f7fa,
  683. 100: #b2ebf2,
  684. 200: #80deea,
  685. 300: #4dd0e1,
  686. 400: #26c6da,
  687. 500: #00bcd4,
  688. 600: #00acc1,
  689. 700: #0097a7,
  690. 800: #00838f,
  691. 900: #006064,
  692. A100: #84ffff,
  693. A200: #18ffff,
  694. A400: #00e5ff,
  695. A700: #00b8d4,
  696. contrast: (
  697. 50: $dark-primary-text,
  698. 100: $dark-primary-text,
  699. 200: $dark-primary-text,
  700. 300: $dark-primary-text,
  701. 400: $dark-primary-text,
  702. 500: $light-primary-text,
  703. 600: $light-primary-text,
  704. 700: $light-primary-text,
  705. 800: $light-primary-text,
  706. 900: $light-primary-text,
  707. A100: $dark-primary-text,
  708. A200: $dark-primary-text,
  709. A400: $dark-primary-text,
  710. A700: $dark-primary-text,
  711. )
  712. );
  713. $mat-teal: (
  714. 50: #e0f2f1,
  715. 100: #b2dfdb,
  716. 200: #80cbc4,
  717. 300: #4db6ac,
  718. 400: #26a69a,
  719. 500: #009688,
  720. 600: #00897b,
  721. 700: #00796b,
  722. 800: #00695c,
  723. 900: #004d40,
  724. A100: #a7ffeb,
  725. A200: #64ffda,
  726. A400: #1de9b6,
  727. A700: #00bfa5,
  728. contrast: (
  729. 50: $dark-primary-text,
  730. 100: $dark-primary-text,
  731. 200: $dark-primary-text,
  732. 300: $dark-primary-text,
  733. 400: $dark-primary-text,
  734. 500: $light-primary-text,
  735. 600: $light-primary-text,
  736. 700: $light-primary-text,
  737. 800: $light-primary-text,
  738. 900: $light-primary-text,
  739. A100: $dark-primary-text,
  740. A200: $dark-primary-text,
  741. A400: $dark-primary-text,
  742. A700: $dark-primary-text,
  743. )
  744. );
  745. $mat-green: (
  746. 50: #e8f5e9,
  747. 100: #c8e6c9,
  748. 200: #a5d6a7,
  749. 300: #81c784,
  750. 400: #66bb6a,
  751. 500: #4caf50,
  752. 600: #43a047,
  753. 700: #388e3c,
  754. 800: #2e7d32,
  755. 900: #1b5e20,
  756. A100: #b9f6ca,
  757. A200: #69f0ae,
  758. A400: #00e676,
  759. A700: #00c853,
  760. contrast: (
  761. 50: $dark-primary-text,
  762. 100: $dark-primary-text,
  763. 200: $dark-primary-text,
  764. 300: $dark-primary-text,
  765. 400: $dark-primary-text,
  766. 500: $dark-primary-text,
  767. 600: $light-primary-text,
  768. 700: $light-primary-text,
  769. 800: $light-primary-text,
  770. 900: $light-primary-text,
  771. A100: $dark-primary-text,
  772. A200: $dark-primary-text,
  773. A400: $dark-primary-text,
  774. A700: $dark-primary-text,
  775. )
  776. );
  777. $mat-light-green: (
  778. 50: #f1f8e9,
  779. 100: #dcedc8,
  780. 200: #c5e1a5,
  781. 300: #aed581,
  782. 400: #9ccc65,
  783. 500: #8bc34a,
  784. 600: #7cb342,
  785. 700: #689f38,
  786. 800: #558b2f,
  787. 900: #33691e,
  788. A100: #ccff90,
  789. A200: #b2ff59,
  790. A400: #76ff03,
  791. A700: #64dd17,
  792. contrast: (
  793. 50: $dark-primary-text,
  794. 100: $dark-primary-text,
  795. 200: $dark-primary-text,
  796. 300: $dark-primary-text,
  797. 400: $dark-primary-text,
  798. 500: $dark-primary-text,
  799. 600: $dark-primary-text,
  800. 700: $light-primary-text,
  801. 800: $light-primary-text,
  802. 900: $light-primary-text,
  803. A100: $dark-primary-text,
  804. A200: $dark-primary-text,
  805. A400: $dark-primary-text,
  806. A700: $dark-primary-text,
  807. )
  808. );
  809. $mat-lime: (
  810. 50: #f9fbe7,
  811. 100: #f0f4c3,
  812. 200: #e6ee9c,
  813. 300: #dce775,
  814. 400: #d4e157,
  815. 500: #cddc39,
  816. 600: #c0ca33,
  817. 700: #afb42b,
  818. 800: #9e9d24,
  819. 900: #827717,
  820. A100: #f4ff81,
  821. A200: #eeff41,
  822. A400: #c6ff00,
  823. A700: #aeea00,
  824. contrast: (
  825. 50: $dark-primary-text,
  826. 100: $dark-primary-text,
  827. 200: $dark-primary-text,
  828. 300: $dark-primary-text,
  829. 400: $dark-primary-text,
  830. 500: $dark-primary-text,
  831. 600: $dark-primary-text,
  832. 700: $dark-primary-text,
  833. 800: $dark-primary-text,
  834. 900: $light-primary-text,
  835. A100: $dark-primary-text,
  836. A200: $dark-primary-text,
  837. A400: $dark-primary-text,
  838. A700: $dark-primary-text,
  839. )
  840. );
  841. $mat-yellow: (
  842. 50: #fffde7,
  843. 100: #fff9c4,
  844. 200: #fff59d,
  845. 300: #fff176,
  846. 400: #ffee58,
  847. 500: #ffeb3b,
  848. 600: #fdd835,
  849. 700: #fbc02d,
  850. 800: #f9a825,
  851. 900: #f57f17,
  852. A100: #ffff8d,
  853. A200: #ffff00,
  854. A400: #ffea00,
  855. A700: #ffd600,
  856. contrast: (
  857. 50: $dark-primary-text,
  858. 100: $dark-primary-text,
  859. 200: $dark-primary-text,
  860. 300: $dark-primary-text,
  861. 400: $dark-primary-text,
  862. 500: $dark-primary-text,
  863. 600: $dark-primary-text,
  864. 700: $dark-primary-text,
  865. 800: $dark-primary-text,
  866. 900: $dark-primary-text,
  867. A100: $dark-primary-text,
  868. A200: $dark-primary-text,
  869. A400: $dark-primary-text,
  870. A700: $dark-primary-text,
  871. )
  872. );
  873. $mat-amber: (
  874. 50: #fff8e1,
  875. 100: #ffecb3,
  876. 200: #ffe082,
  877. 300: #ffd54f,
  878. 400: #ffca28,
  879. 500: #ffc107,
  880. 600: #ffb300,
  881. 700: #ffa000,
  882. 800: #ff8f00,
  883. 900: #ff6f00,
  884. A100: #ffe57f,
  885. A200: #ffd740,
  886. A400: #ffc400,
  887. A700: #ffab00,
  888. contrast: (
  889. 50: $dark-primary-text,
  890. 100: $dark-primary-text,
  891. 200: $dark-primary-text,
  892. 300: $dark-primary-text,
  893. 400: $dark-primary-text,
  894. 500: $dark-primary-text,
  895. 600: $dark-primary-text,
  896. 700: $dark-primary-text,
  897. 800: $dark-primary-text,
  898. 900: $dark-primary-text,
  899. A100: $dark-primary-text,
  900. A200: $dark-primary-text,
  901. A400: $dark-primary-text,
  902. A700: $dark-primary-text,
  903. )
  904. );
  905. $mat-orange: (
  906. 50: #fff3e0,
  907. 100: #ffe0b2,
  908. 200: #ffcc80,
  909. 300: #ffb74d,
  910. 400: #ffa726,
  911. 500: #ff9800,
  912. 600: #fb8c00,
  913. 700: #f57c00,
  914. 800: #ef6c00,
  915. 900: #e65100,
  916. A100: #ffd180,
  917. A200: #ffab40,
  918. A400: #ff9100,
  919. A700: #ff6d00,
  920. contrast: (
  921. 50: $dark-primary-text,
  922. 100: $dark-primary-text,
  923. 200: $dark-primary-text,
  924. 300: $dark-primary-text,
  925. 400: $dark-primary-text,
  926. 500: $dark-primary-text,
  927. 600: $dark-primary-text,
  928. 700: $dark-primary-text,
  929. 800: $light-primary-text,
  930. 900: $light-primary-text,
  931. A100: $dark-primary-text,
  932. A200: $dark-primary-text,
  933. A400: $dark-primary-text,
  934. A700: black,
  935. )
  936. );
  937. $mat-deep-orange: (
  938. 50: #fbe9e7,
  939. 100: #ffccbc,
  940. 200: #ffab91,
  941. 300: #ff8a65,
  942. 400: #ff7043,
  943. 500: #ff5722,
  944. 600: #f4511e,
  945. 700: #e64a19,
  946. 800: #d84315,
  947. 900: #bf360c,
  948. A100: #ff9e80,
  949. A200: #ff6e40,
  950. A400: #ff3d00,
  951. A700: #dd2c00,
  952. contrast: (
  953. 50: $dark-primary-text,
  954. 100: $dark-primary-text,
  955. 200: $dark-primary-text,
  956. 300: $dark-primary-text,
  957. 400: $dark-primary-text,
  958. 500: $light-primary-text,
  959. 600: $light-primary-text,
  960. 700: $light-primary-text,
  961. 800: $light-primary-text,
  962. 900: $light-primary-text,
  963. A100: $dark-primary-text,
  964. A200: $dark-primary-text,
  965. A400: $light-primary-text,
  966. A700: $light-primary-text,
  967. )
  968. );
  969. $mat-brown: (
  970. 50: #efebe9,
  971. 100: #d7ccc8,
  972. 200: #bcaaa4,
  973. 300: #a1887f,
  974. 400: #8d6e63,
  975. 500: #795548,
  976. 600: #6d4c41,
  977. 700: #5d4037,
  978. 800: #4e342e,
  979. 900: #3e2723,
  980. A100: #d7ccc8,
  981. A200: #bcaaa4,
  982. A400: #8d6e63,
  983. A700: #5d4037,
  984. contrast: (
  985. 50: $dark-primary-text,
  986. 100: $dark-primary-text,
  987. 200: $dark-primary-text,
  988. 300: $light-primary-text,
  989. 400: $light-primary-text,
  990. 500: $light-primary-text,
  991. 600: $light-primary-text,
  992. 700: $light-primary-text,
  993. 800: $light-primary-text,
  994. 900: $light-primary-text,
  995. A100: $dark-primary-text,
  996. A200: $dark-primary-text,
  997. A400: $light-primary-text,
  998. A700: $light-primary-text,
  999. )
  1000. );
  1001. $mat-grey: (
  1002. 50: #fafafa,
  1003. 100: #f5f5f5,
  1004. 200: #eeeeee,
  1005. 300: #e0e0e0,
  1006. 400: #bdbdbd,
  1007. 500: #9e9e9e,
  1008. 600: #757575,
  1009. 700: #616161,
  1010. 800: #424242,
  1011. 900: #212121,
  1012. A100: #ffffff,
  1013. A200: #eeeeee,
  1014. A400: #bdbdbd,
  1015. A700: #616161,
  1016. contrast: (
  1017. 50: $dark-primary-text,
  1018. 100: $dark-primary-text,
  1019. 200: $dark-primary-text,
  1020. 300: $dark-primary-text,
  1021. 400: $dark-primary-text,
  1022. 500: $dark-primary-text,
  1023. 600: $light-primary-text,
  1024. 700: $light-primary-text,
  1025. 800: $light-primary-text,
  1026. 900: $light-primary-text,
  1027. A100: $dark-primary-text,
  1028. A200: $dark-primary-text,
  1029. A400: $dark-primary-text,
  1030. A700: $light-primary-text,
  1031. )
  1032. );
  1033. // Alias for alternate spelling.
  1034. $mat-gray: $mat-grey;
  1035. $mat-blue-grey: (
  1036. 50: #eceff1,
  1037. 100: #cfd8dc,
  1038. 200: #b0bec5,
  1039. 300: #90a4ae,
  1040. 400: #78909c,
  1041. 500: #607d8b,
  1042. 600: #546e7a,
  1043. 700: #455a64,
  1044. 800: #37474f,
  1045. 900: #263238,
  1046. A100: #cfd8dc,
  1047. A200: #b0bec5,
  1048. A400: #78909c,
  1049. A700: #455a64,
  1050. contrast: (
  1051. 50: $dark-primary-text,
  1052. 100: $dark-primary-text,
  1053. 200: $dark-primary-text,
  1054. 300: $dark-primary-text,
  1055. 400: $light-primary-text,
  1056. 500: $light-primary-text,
  1057. 600: $light-primary-text,
  1058. 700: $light-primary-text,
  1059. 800: $light-primary-text,
  1060. 900: $light-primary-text,
  1061. A100: $dark-primary-text,
  1062. A200: $dark-primary-text,
  1063. A400: $light-primary-text,
  1064. A700: $light-primary-text,
  1065. )
  1066. );
  1067. // Alias for alternate spelling.
  1068. $mat-blue-gray: $mat-blue-grey;
  1069. // Background palette for light themes.
  1070. $mat-light-theme-background: (
  1071. status-bar: map_get($mat-grey, 300),
  1072. app-bar: map_get($mat-grey, 100),
  1073. background: map_get($mat-grey, 50),
  1074. hover: rgba(black, 0.04), // TODO(kara): check style with Material Design UX
  1075. card: white,
  1076. dialog: white,
  1077. disabled-button: rgba(black, 0.12),
  1078. raised-button: white,
  1079. focused-button: $dark-focused,
  1080. selected-button: map_get($mat-grey, 300),
  1081. selected-disabled-button: map_get($mat-grey, 400),
  1082. disabled-button-toggle: map_get($mat-grey, 200),
  1083. unselected-chip: map_get($mat-grey, 300),
  1084. disabled-list-option: map_get($mat-grey, 200),
  1085. );
  1086. // Background palette for dark themes.
  1087. $mat-dark-theme-background: (
  1088. status-bar: black,
  1089. app-bar: map_get($mat-grey, 900),
  1090. background: #303030,
  1091. hover: rgba(white, 0.04), // TODO(kara): check style with Material Design UX
  1092. card: map_get($mat-grey, 800),
  1093. dialog: map_get($mat-grey, 800),
  1094. disabled-button: rgba(white, 0.12),
  1095. raised-button: map-get($mat-grey, 800),
  1096. focused-button: $light-focused,
  1097. selected-button: map_get($mat-grey, 900),
  1098. selected-disabled-button: map_get($mat-grey, 800),
  1099. disabled-button-toggle: black,
  1100. unselected-chip: map_get($mat-grey, 700),
  1101. disabled-list-option: black,
  1102. );
  1103. // Foreground palette for light themes.
  1104. $mat-light-theme-foreground: (
  1105. base: black,
  1106. divider: $dark-dividers,
  1107. dividers: $dark-dividers,
  1108. disabled: $dark-disabled-text,
  1109. disabled-button: rgba(black, 0.26),
  1110. disabled-text: $dark-disabled-text,
  1111. elevation: black,
  1112. hint-text: $dark-disabled-text,
  1113. secondary-text: $dark-secondary-text,
  1114. icon: rgba(black, 0.54),
  1115. icons: rgba(black, 0.54),
  1116. text: rgba(black, 0.87),
  1117. slider-min: rgba(black, 0.87),
  1118. slider-off: rgba(black, 0.26),
  1119. slider-off-active: rgba(black, 0.38),
  1120. );
  1121. // Foreground palette for dark themes.
  1122. $mat-dark-theme-foreground: (
  1123. base: white,
  1124. divider: $light-dividers,
  1125. dividers: $light-dividers,
  1126. disabled: $light-disabled-text,
  1127. disabled-button: rgba(white, 0.3),
  1128. disabled-text: $light-disabled-text,
  1129. elevation: black,
  1130. hint-text: $light-disabled-text,
  1131. secondary-text: $light-secondary-text,
  1132. icon: white,
  1133. icons: white,
  1134. text: white,
  1135. slider-min: white,
  1136. slider-off: rgba(white, 0.3),
  1137. slider-off-active: rgba(white, 0.3),
  1138. );
  1139. // For a given hue in a palette, return the contrast color from the map of contrast palettes.
  1140. // @param $color-map
  1141. // @param $hue
  1142. @function mat-contrast($palette, $hue) {
  1143. @return map-get(map-get($palette, contrast), $hue);
  1144. }
  1145. // Creates a map of hues to colors for a theme. This is used to define a theme palette in terms
  1146. // of the Material Design hues.
  1147. // @param $color-map
  1148. // @param $primary
  1149. // @param $lighter
  1150. @function mat-palette($base-palette, $default: 500, $lighter: 100, $darker: 700, $text: $default) {
  1151. $result: map_merge($base-palette, (
  1152. default: map-get($base-palette, $default),
  1153. lighter: map-get($base-palette, $lighter),
  1154. darker: map-get($base-palette, $darker),
  1155. text: map-get($base-palette, $text),
  1156. default-contrast: mat-contrast($base-palette, $default),
  1157. lighter-contrast: mat-contrast($base-palette, $lighter),
  1158. darker-contrast: mat-contrast($base-palette, $darker)
  1159. ));
  1160. // For each hue in the palette, add a "-contrast" color to the map.
  1161. @each $hue, $color in $base-palette {
  1162. $result: map_merge($result, (
  1163. '#{$hue}-contrast': mat-contrast($base-palette, $hue)
  1164. ));
  1165. }
  1166. @return $result;
  1167. }
  1168. // Gets a color from a theme palette (the output of mat-palette).
  1169. // The hue can be one of the standard values (500, A400, etc.), one of the three preconfigured
  1170. // hues (default, lighter, darker), or any of the aforementioned prefixed with "-contrast".
  1171. //
  1172. // @param $color-map The theme palette (output of mat-palette).
  1173. // @param $hue The hue from the palette to use. If this is a value between 0 and 1, it will
  1174. // be treated as opacity.
  1175. // @param $opacity The alpha channel value for the color.
  1176. @function mat-color($palette, $hue: default, $opacity: null) {
  1177. // If hueKey is a number between zero and one, then it actually contains an
  1178. // opacity value, so recall this function with the default hue and that given opacity.
  1179. @if type-of($hue) == number and $hue >= 0 and $hue <= 1 {
  1180. @return mat-color($palette, default, $hue);
  1181. }
  1182. $color: map-get($palette, $hue);
  1183. @if (type-of($color) != color) {
  1184. // If the $color resolved to something different from a color (e.g. a CSS variable),
  1185. // we can't apply the opacity anyway so we return the value as is, otherwise Sass can
  1186. // throw an error or output something invalid.
  1187. @return $color;
  1188. }
  1189. @return rgba($color, if($opacity == null, opacity($color), $opacity));
  1190. }
  1191. // Creates a container object for a light theme to be given to individual component theme mixins.
  1192. @function mat-light-theme($primary, $accent, $warn: mat-palette($mat-red)) {
  1193. @return (
  1194. primary: $primary,
  1195. accent: $accent,
  1196. warn: $warn,
  1197. is-dark: false,
  1198. foreground: $mat-light-theme-foreground,
  1199. background: $mat-light-theme-background,
  1200. );
  1201. }
  1202. // Creates a container object for a dark theme to be given to individual component theme mixins.
  1203. @function mat-dark-theme($primary, $accent, $warn: mat-palette($mat-red)) {
  1204. @return (
  1205. primary: $primary,
  1206. accent: $accent,
  1207. warn: $warn,
  1208. is-dark: true,
  1209. foreground: $mat-dark-theme-foreground,
  1210. background: $mat-dark-theme-background,
  1211. );
  1212. }
  1213. $mat-ripple-color-opacity: 0.1;
  1214. @mixin mat-ripple() {
  1215. // The host element of an mat-ripple directive should always have a position of "absolute" or
  1216. // "relative" so that the ripples inside are correctly positioned relatively to the container.
  1217. .mat-ripple {
  1218. overflow: hidden;
  1219. // By default, every ripple container should have position: relative in favor of creating an
  1220. // easy API for developers using the MatRipple directive.
  1221. position: relative;
  1222. }
  1223. .mat-ripple.mat-ripple-unbounded {
  1224. overflow: visible;
  1225. }
  1226. .mat-ripple-element {
  1227. position: absolute;
  1228. border-radius: 50%;
  1229. pointer-events: none;
  1230. transition: opacity, transform 0ms cubic-bezier(0, 0, 0.2, 1);
  1231. transform: scale(0);
  1232. // In high contrast mode the ripple is opaque, causing it to obstruct the content.
  1233. @include cdk-high-contrast {
  1234. display: none;
  1235. }
  1236. }
  1237. }
  1238. /* Theme for the ripple elements.*/
  1239. @mixin mat-ripple-theme($theme) {
  1240. $foreground: map_get($theme, foreground);
  1241. $foreground-base: map_get($foreground, base);
  1242. .mat-ripple-element {
  1243. // If the ripple color is resolves to a color *type*, we can use it directly, otherwise
  1244. // (e.g. it resolves to a CSS variable) we fall back to using the color and setting an opacity.
  1245. @if (type-of($foreground-base) == color) {
  1246. background-color: rgba($foreground-base, $mat-ripple-color-opacity);
  1247. }
  1248. @else {
  1249. background-color: $foreground-base;
  1250. opacity: $mat-ripple-color-opacity;
  1251. }
  1252. }
  1253. }
  1254. // Utility for fetching a nested value from a typography config.
  1255. @function _mat-get-type-value($config, $level, $name) {
  1256. @return map-get(map-get($config, $level), $name);
  1257. }
  1258. // Gets the font size for a level inside a typography config.
  1259. @function mat-font-size($config, $level) {
  1260. @return _mat-get-type-value($config, $level, font-size);
  1261. }
  1262. // Gets the line height for a level inside a typography config.
  1263. @function mat-line-height($config, $level) {
  1264. @return _mat-get-type-value($config, $level, line-height);
  1265. }
  1266. // Gets the font weight for a level inside a typography config.
  1267. @function mat-font-weight($config, $level) {
  1268. @return _mat-get-type-value($config, $level, font-weight);
  1269. }
  1270. // Gets the letter spacing for a level inside a typography config.
  1271. @function mat-letter-spacing($config, $level) {
  1272. @return _mat-get-type-value($config, $level, letter-spacing);
  1273. }
  1274. // Gets the font-family from a typography config and removes the quotes around it.
  1275. @function mat-font-family($config, $level: null) {
  1276. $font-family: map-get($config, font-family);
  1277. @if $level != null {
  1278. $font-family: _mat-get-type-value($config, $level, font-family);
  1279. }
  1280. // Guard against unquoting non-string values, because it's deprecated.
  1281. @return if(type-of($font-family) == string, unquote($font-family), $font-family);
  1282. }
  1283. // Outputs the shorthand `font` CSS property, based on a set of typography values. Falls back to
  1284. // the individual properties if a value that isn't allowed in the shorthand is passed in.
  1285. @mixin mat-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family) {
  1286. // If any of the values are set to `inherit`, we can't use the shorthand
  1287. // so we fall back to passing in the individual properties.
  1288. @if ($font-size == inherit or
  1289. $font-weight == inherit or
  1290. $line-height == inherit or
  1291. $font-family == inherit or
  1292. $font-size == null or
  1293. $font-weight == null or
  1294. $line-height == null or
  1295. $font-family == null) {
  1296. font-size: $font-size;
  1297. font-weight: $font-weight;
  1298. line-height: $line-height;
  1299. font-family: $font-family;
  1300. }
  1301. @else {
  1302. // Otherwise use the shorthand `font`, because it's the least amount of bytes. Note
  1303. // that we need to use interpolation for `font-size/line-height` in order to prevent
  1304. // Sass from dividing the two values.
  1305. font: $font-weight #{$font-size}/#{$line-height} $font-family;
  1306. }
  1307. }
  1308. // Converts a typography level into CSS styles.
  1309. @mixin mat-typography-level-to-styles($config, $level) {
  1310. $font-size: mat-font-size($config, $level);
  1311. $font-weight: mat-font-weight($config, $level);
  1312. $line-height: mat-line-height($config, $level);
  1313. $font-family: mat-font-family($config, $level);
  1314. @include mat-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family);
  1315. letter-spacing: mat-letter-spacing($config, $level);
  1316. }
  1317. @mixin mat-option-theme($theme) {
  1318. $foreground: map-get($theme, foreground);
  1319. $background: map-get($theme, background);
  1320. $primary: map-get($theme, primary);
  1321. $accent: map-get($theme, accent);
  1322. $warn: map-get($theme, warn);
  1323. .mat-option {
  1324. color: mat-color($foreground, text);
  1325. &:hover:not(.mat-option-disabled),
  1326. &:focus:not(.mat-option-disabled) {
  1327. background: mat-color($background, hover);
  1328. }
  1329. // In multiple mode there is a checkbox to show that the option is selected.
  1330. &.mat-selected:not(.mat-option-multiple):not(.mat-option-disabled) {
  1331. background: mat-color($background, hover);
  1332. }
  1333. &.mat-active {
  1334. background: mat-color($background, hover);
  1335. color: mat-color($foreground, text);
  1336. }
  1337. &.mat-option-disabled {
  1338. color: mat-color($foreground, hint-text);
  1339. }
  1340. }
  1341. .mat-primary .mat-option.mat-selected:not(.mat-option-disabled) {
  1342. color: mat-color($primary, text);
  1343. }
  1344. .mat-accent .mat-option.mat-selected:not(.mat-option-disabled) {
  1345. color: mat-color($accent, text);
  1346. }
  1347. .mat-warn .mat-option.mat-selected:not(.mat-option-disabled) {
  1348. color: mat-color($warn, text);
  1349. }
  1350. }
  1351. @mixin mat-option-typography($config) {
  1352. .mat-option {
  1353. font: {
  1354. family: mat-font-family($config);
  1355. size: mat-font-size($config, subheading-2);
  1356. }
  1357. }
  1358. }
  1359. @mixin mat-optgroup-theme($theme) {
  1360. $foreground: map-get($theme, foreground);
  1361. .mat-optgroup-label {
  1362. color: mat-color($foreground, secondary-text);
  1363. }
  1364. .mat-optgroup-disabled .mat-optgroup-label {
  1365. color: mat-color($foreground, hint-text);
  1366. }
  1367. }
  1368. @mixin mat-optgroup-typography($config) {
  1369. .mat-optgroup-label {
  1370. @include mat-typography-level-to-styles($config, body-2);
  1371. }
  1372. }
  1373. @mixin mat-pseudo-checkbox-theme($theme) {
  1374. $is-dark-theme: map-get($theme, is-dark);
  1375. $primary: map-get($theme, primary);
  1376. $accent: map-get($theme, accent);
  1377. $warn: map-get($theme, warn);
  1378. $background: map-get($theme, background);
  1379. // NOTE(traviskaufman): While the spec calls for translucent blacks/whites for disabled colors,
  1380. // this does not work well with elements layered on top of one another. To get around this we
  1381. // blend the colors together based on the base color and the theme background.
  1382. $white-30pct-opacity-on-dark: #686868;
  1383. $black-26pct-opacity-on-light: #b0b0b0;
  1384. $disabled-color: if($is-dark-theme, $white-30pct-opacity-on-dark, $black-26pct-opacity-on-light);
  1385. $colored-box-selector: '.mat-pseudo-checkbox-checked, .mat-pseudo-checkbox-indeterminate';
  1386. .mat-pseudo-checkbox {
  1387. color: mat-color(map-get($theme, foreground), secondary-text);
  1388. &::after {
  1389. color: mat-color($background, background);
  1390. }
  1391. }
  1392. .mat-pseudo-checkbox-disabled {
  1393. color: $disabled-color;
  1394. }
  1395. // Default to the accent color. Note that the pseudo checkboxes are meant to inherit the
  1396. // theme from their parent, rather than implementing their own theming, which is why we
  1397. // don't attach to the `mat-*` classes.
  1398. .mat-pseudo-checkbox-checked,
  1399. .mat-pseudo-checkbox-indeterminate,
  1400. .mat-accent .mat-pseudo-checkbox-checked,
  1401. .mat-accent .mat-pseudo-checkbox-indeterminate {
  1402. background: mat-color(map-get($theme, accent));
  1403. }
  1404. .mat-primary .mat-pseudo-checkbox-checked,
  1405. .mat-primary .mat-pseudo-checkbox-indeterminate {
  1406. background: mat-color(map-get($theme, primary));
  1407. }
  1408. .mat-warn .mat-pseudo-checkbox-checked,
  1409. .mat-warn .mat-pseudo-checkbox-indeterminate {
  1410. background: mat-color(map-get($theme, warn));
  1411. }
  1412. .mat-pseudo-checkbox-checked,
  1413. .mat-pseudo-checkbox-indeterminate {
  1414. &.mat-pseudo-checkbox-disabled {
  1415. background: $disabled-color;
  1416. }
  1417. }
  1418. }
  1419. // Represents a typography level from the Material design spec.
  1420. @function mat-typography-level(
  1421. $font-size,
  1422. $line-height: $font-size,
  1423. $font-weight: 400,
  1424. $font-family: null,
  1425. $letter-spacing: null) {
  1426. @return (
  1427. font-size: $font-size,
  1428. line-height: $line-height,
  1429. font-weight: $font-weight,
  1430. font-family: $font-family,
  1431. letter-spacing: $letter-spacing
  1432. );
  1433. }
  1434. // Represents a collection of typography levels.
  1435. // Defaults come from https://material.io/guidelines/style/typography.html
  1436. // Note: The spec doesn't mention letter spacing. The values here come from
  1437. // eyeballing it until it looked exactly like the spec examples.
  1438. @function mat-typography-config(
  1439. $font-family: 'Roboto, "Helvetica Neue", sans-serif',
  1440. $display-4: mat-typography-level(112px, 112px, 300, $letter-spacing: -0.05em),
  1441. $display-3: mat-typography-level(56px, 56px, 400, $letter-spacing: -0.02em),
  1442. $display-2: mat-typography-level(45px, 48px, 400, $letter-spacing: -0.005em),
  1443. $display-1: mat-typography-level(34px, 40px, 400),
  1444. $headline: mat-typography-level(24px, 32px, 400),
  1445. $title: mat-typography-level(20px, 32px, 500),
  1446. $subheading-2: mat-typography-level(16px, 28px, 400),
  1447. $subheading-1: mat-typography-level(15px, 24px, 400),
  1448. $body-2: mat-typography-level(14px, 24px, 500),
  1449. $body-1: mat-typography-level(14px, 20px, 400),
  1450. $caption: mat-typography-level(12px, 20px, 400),
  1451. $button: mat-typography-level(14px, 14px, 500),
  1452. // Line-height must be unit-less fraction of the font-size.
  1453. $input: mat-typography-level(inherit, 1.125, 400)
  1454. ) {
  1455. // Declare an initial map with all of the levels.
  1456. $config: (
  1457. display-4: $display-4,
  1458. display-3: $display-3,
  1459. display-2: $display-2,
  1460. display-1: $display-1,
  1461. headline: $headline,
  1462. title: $title,
  1463. subheading-2: $subheading-2,
  1464. subheading-1: $subheading-1,
  1465. body-2: $body-2,
  1466. body-1: $body-1,
  1467. caption: $caption,
  1468. button: $button,
  1469. input: $input,
  1470. );
  1471. // Loop through the levels and set the `font-family` of the ones that don't have one to the base.
  1472. // Note that Sass can't modify maps in place, which means that we need to merge and re-assign.
  1473. @each $key, $level in $config {
  1474. @if map-get($level, font-family) == null {
  1475. $new-level: map-merge($level, (font-family: $font-family));
  1476. $config: map-merge($config, ($key: $new-level));
  1477. }
  1478. }
  1479. // Add the base font family to the config.
  1480. @return map-merge($config, (font-family: $font-family));
  1481. }
  1482. // Adds the base typography styles, based on a config.
  1483. @mixin mat-base-typography($config, $selector: '.mat-typography') {
  1484. .mat-h1, .mat-headline, #{$selector} h1 {
  1485. @include mat-typography-level-to-styles($config, headline);
  1486. margin: 0 0 16px;
  1487. }
  1488. .mat-h2, .mat-title, #{$selector} h2 {
  1489. @include mat-typography-level-to-styles($config, title);
  1490. margin: 0 0 16px;
  1491. }
  1492. .mat-h3, .mat-subheading-2, #{$selector} h3 {
  1493. @include mat-typography-level-to-styles($config, subheading-2);
  1494. margin: 0 0 16px;
  1495. }
  1496. .mat-h4, .mat-subheading-1, #{$selector} h4 {
  1497. @include mat-typography-level-to-styles($config, subheading-1);
  1498. margin: 0 0 16px;
  1499. }
  1500. // Note: the spec doesn't have anything that would correspond to h5 and h6, but we add these for
  1501. // consistency. The font sizes come from the Chrome user agent styles which have h5 at 0.83em
  1502. // and h6 at 0.67em.
  1503. .mat-h5, #{$selector} h5 {
  1504. @include mat-typography-font-shorthand(
  1505. // calc is used here to support css variables
  1506. calc(#{mat-font-size($config, body-1)} * 0.83),
  1507. mat-font-weight($config, body-1),
  1508. mat-line-height($config, body-1),
  1509. mat-font-family($config, body-1)
  1510. );
  1511. margin: 0 0 12px;
  1512. }
  1513. .mat-h6, #{$selector} h6 {
  1514. @include mat-typography-font-shorthand(
  1515. // calc is used here to support css variables
  1516. calc(#{mat-font-size($config, body-1)} * 0.67),
  1517. mat-font-weight($config, body-1),
  1518. mat-line-height($config, body-1),
  1519. mat-font-family($config, body-1)
  1520. );
  1521. margin: 0 0 12px;
  1522. }
  1523. .mat-body-strong, .mat-body-2 {
  1524. @include mat-typography-level-to-styles($config, body-2);
  1525. }
  1526. .mat-body, .mat-body-1, #{$selector} {
  1527. @include mat-typography-level-to-styles($config, body-1);
  1528. p {
  1529. margin: 0 0 12px;
  1530. }
  1531. }
  1532. .mat-small, .mat-caption {
  1533. @include mat-typography-level-to-styles($config, caption);
  1534. }
  1535. .mat-display-4, #{$selector} .mat-display-4 {
  1536. @include mat-typography-level-to-styles($config, display-4);
  1537. margin: 0 0 56px;
  1538. }
  1539. .mat-display-3, #{$selector} .mat-display-3 {
  1540. @include mat-typography-level-to-styles($config, display-3);
  1541. margin: 0 0 64px;
  1542. }
  1543. .mat-display-2, #{$selector} .mat-display-2 {
  1544. @include mat-typography-level-to-styles($config, display-2);
  1545. margin: 0 0 64px;
  1546. }
  1547. .mat-display-1, #{$selector} .mat-display-1 {
  1548. @include mat-typography-level-to-styles($config, display-1);
  1549. margin: 0 0 64px;
  1550. }
  1551. }
  1552. @mixin mat-autocomplete-theme($theme) {
  1553. $foreground: map-get($theme, foreground);
  1554. $background: map-get($theme, background);
  1555. .mat-autocomplete-panel {
  1556. @include _mat-theme-overridable-elevation(4, $theme);
  1557. background: mat-color($background, card);
  1558. color: mat-color($foreground, text);
  1559. // Selected options in autocompletes should not be gray, but we
  1560. // only want to override the background for selected options if
  1561. // they are *not* in hover or focus state. This change has to be
  1562. // made here because base option styles are shared between the
  1563. // autocomplete and the select.
  1564. .mat-option.mat-selected:not(.mat-active):not(:hover) {
  1565. background: mat-color($background, card);
  1566. &:not(.mat-option-disabled) {
  1567. color: mat-color($foreground, text);
  1568. }
  1569. }
  1570. }
  1571. }
  1572. @mixin mat-autocomplete-typography($config) { }
  1573. // This contains all of the styles for the badge
  1574. // rather than just the color/theme because of
  1575. // no style sheet support for directives.
  1576. $mat-badge-font-size: 12px;
  1577. $mat-badge-font-weight: 600;
  1578. $mat-badge-default-size: 22px !default;
  1579. $mat-badge-small-size: $mat-badge-default-size - 6;
  1580. $mat-badge-large-size: $mat-badge-default-size + 6;
  1581. // Mixin for building offset given different sizes
  1582. @mixin _mat-badge-size($size) {
  1583. .mat-badge-content {
  1584. width: $size;
  1585. height: $size;
  1586. line-height: $size;
  1587. }
  1588. &.mat-badge-above {
  1589. .mat-badge-content {
  1590. top: -$size / 2;
  1591. }
  1592. }
  1593. &.mat-badge-below {
  1594. .mat-badge-content {
  1595. bottom: -$size / 2;
  1596. }
  1597. }
  1598. &.mat-badge-before {
  1599. .mat-badge-content {
  1600. left: -$size;
  1601. }
  1602. }
  1603. [dir='rtl'] &.mat-badge-before {
  1604. .mat-badge-content {
  1605. left: auto;
  1606. right: -$size;
  1607. }
  1608. }
  1609. &.mat-badge-after {
  1610. .mat-badge-content {
  1611. right: -$size;
  1612. }
  1613. }
  1614. [dir='rtl'] &.mat-badge-after {
  1615. .mat-badge-content {
  1616. right: auto;
  1617. left: -$size;
  1618. }
  1619. }
  1620. &.mat-badge-overlap {
  1621. &.mat-badge-before {
  1622. .mat-badge-content {
  1623. left: -$size / 2;
  1624. }
  1625. }
  1626. [dir='rtl'] &.mat-badge-before {
  1627. .mat-badge-content {
  1628. left: auto;
  1629. right: -$size / 2;
  1630. }
  1631. }
  1632. &.mat-badge-after {
  1633. .mat-badge-content {
  1634. right: -$size / 2;
  1635. }
  1636. }
  1637. [dir='rtl'] &.mat-badge-after {
  1638. .mat-badge-content {
  1639. right: auto;
  1640. left: -$size / 2;
  1641. }
  1642. }
  1643. }
  1644. }
  1645. @mixin mat-badge-theme($theme) {
  1646. $accent: map-get($theme, accent);
  1647. $warn: map-get($theme, warn);
  1648. $primary: map-get($theme, primary);
  1649. $background: map-get($theme, background);
  1650. $foreground: map-get($theme, foreground);
  1651. .mat-badge-content {
  1652. color: mat-color($primary, default-contrast);
  1653. background: mat-color($primary);
  1654. @include cdk-high-contrast {
  1655. outline: solid 1px;
  1656. border-radius: 0;
  1657. }
  1658. }
  1659. .mat-badge-accent {
  1660. .mat-badge-content {
  1661. background: mat-color($accent);
  1662. color: mat-color($accent, default-contrast);
  1663. }
  1664. }
  1665. .mat-badge-warn {
  1666. .mat-badge-content {
  1667. color: mat-color($warn, default-contrast);
  1668. background: mat-color($warn);
  1669. }
  1670. }
  1671. .mat-badge {
  1672. position: relative;
  1673. }
  1674. .mat-badge-hidden {
  1675. .mat-badge-content {
  1676. display: none;
  1677. }
  1678. }
  1679. .mat-badge-disabled {
  1680. .mat-badge-content {
  1681. $app-background: mat-color($background, 'background');
  1682. $badge-color: mat-color($foreground, disabled-button);
  1683. // The disabled color usually has some kind of opacity, but because the badge is overlayed
  1684. // on top of something else, it won't look good if it's opaque. If it is a color *type*,
  1685. // we convert it into a solid color by taking the opacity from the rgba value and using
  1686. // the value to determine the percentage of the background to put into foreground when
  1687. // mixing the colors together.
  1688. @if (type-of($badge-color) == color and type-of($app-background) == color) {
  1689. $badge-opacity: opacity($badge-color);
  1690. background: mix($app-background, rgba($badge-color, 1), (1 - $badge-opacity) * 100%);
  1691. }
  1692. @else {
  1693. background: $badge-color;
  1694. }
  1695. color: mat-color($foreground, disabled-text);
  1696. }
  1697. }
  1698. .mat-badge-content {
  1699. position: absolute;
  1700. text-align: center;
  1701. display: inline-block;
  1702. border-radius: 50%;
  1703. transition: transform 200ms ease-in-out;
  1704. transform: scale(0.6);
  1705. overflow: hidden;
  1706. white-space: nowrap;
  1707. text-overflow: ellipsis;
  1708. pointer-events: none;
  1709. }
  1710. .ng-animate-disabled .mat-badge-content,
  1711. .mat-badge-content._mat-animation-noopable {
  1712. transition: none;
  1713. }
  1714. // The active class is added after the element is added
  1715. // so it can animate scale to default
  1716. .mat-badge-content.mat-badge-active {
  1717. // Scale to `none` instead of `1` to avoid blurry text in some browsers.
  1718. transform: none;
  1719. }
  1720. .mat-badge-small {
  1721. @include _mat-badge-size($mat-badge-small-size);
  1722. }
  1723. .mat-badge-medium {
  1724. @include _mat-badge-size($mat-badge-default-size);
  1725. }
  1726. .mat-badge-large {
  1727. @include _mat-badge-size($mat-badge-large-size);
  1728. }
  1729. }
  1730. @mixin mat-badge-typography($config) {
  1731. .mat-badge-content {
  1732. font-weight: $mat-badge-font-weight;
  1733. font-size: $mat-badge-font-size;
  1734. font-family: mat-font-family($config);
  1735. }
  1736. .mat-badge-small .mat-badge-content {
  1737. // Set the font size to 75% of the original.
  1738. font-size: $mat-badge-font-size * 0.75;
  1739. }
  1740. .mat-badge-large .mat-badge-content {
  1741. font-size: $mat-badge-font-size * 2;
  1742. }
  1743. }
  1744. @mixin mat-bottom-sheet-theme($theme) {
  1745. $background: map-get($theme, background);
  1746. $foreground: map-get($theme, foreground);
  1747. .mat-bottom-sheet-container {
  1748. @include _mat-theme-elevation(16, $theme);
  1749. background: mat-color($background, dialog);
  1750. color: mat-color($foreground, text);
  1751. }
  1752. }
  1753. @mixin mat-bottom-sheet-typography($config) {
  1754. .mat-bottom-sheet-container {
  1755. @include mat-typography-level-to-styles($config, body-1);
  1756. }
  1757. }
  1758. $_mat-button-ripple-opacity: 0.1;
  1759. // Applies a focus style to an mat-button element for each of the supported palettes.
  1760. @mixin _mat-button-focus-overlay-color($theme) {
  1761. $primary: map-get($theme, primary);
  1762. $accent: map-get($theme, accent);
  1763. $warn: map-get($theme, warn);
  1764. &.mat-primary .mat-button-focus-overlay {
  1765. background-color: mat-color($primary);
  1766. }
  1767. &.mat-accent .mat-button-focus-overlay {
  1768. background-color: mat-color($accent);
  1769. }
  1770. &.mat-warn .mat-button-focus-overlay {
  1771. background-color: mat-color($warn);
  1772. }
  1773. &[disabled] .mat-button-focus-overlay {
  1774. background-color: transparent;
  1775. }
  1776. }
  1777. // Applies the background color for a ripple. If the value provided is not a Sass color,
  1778. // we assume that we've been given a CSS variable. Since we can't perform alpha-blending
  1779. // on a CSS variable, we instead add the opacity directly to the ripple element.
  1780. @mixin _mat-button-ripple-background($palette, $hue, $opacity) {
  1781. $background-color: mat-color($palette, $hue, $opacity);
  1782. background-color: $background-color;
  1783. @if (type-of($background-color) != color) {
  1784. opacity: $opacity;
  1785. }
  1786. }
  1787. @mixin _mat-button-ripple-color($theme, $hue, $opacity: $_mat-button-ripple-opacity) {
  1788. $primary: map-get($theme, primary);
  1789. $accent: map-get($theme, accent);
  1790. $warn: map-get($theme, warn);
  1791. &.mat-primary .mat-ripple-element {
  1792. @include _mat-button-ripple-background($primary, $hue, $opacity);
  1793. }
  1794. &.mat-accent .mat-ripple-element {
  1795. @include _mat-button-ripple-background($accent, $hue, $opacity);
  1796. }
  1797. &.mat-warn .mat-ripple-element {
  1798. @include _mat-button-ripple-background($warn, $hue, $opacity);
  1799. }
  1800. }
  1801. // Applies a property to an mat-button element for each of the supported palettes.
  1802. @mixin _mat-button-theme-property($theme, $property, $hue) {
  1803. $primary: map-get($theme, primary);
  1804. $accent: map-get($theme, accent);
  1805. $warn: map-get($theme, warn);
  1806. $background: map-get($theme, background);
  1807. $foreground: map-get($theme, foreground);
  1808. &.mat-primary {
  1809. #{$property}: mat-color($primary, $hue);
  1810. }
  1811. &.mat-accent {
  1812. #{$property}: mat-color($accent, $hue);
  1813. }
  1814. &.mat-warn {
  1815. #{$property}: mat-color($warn, $hue);
  1816. }
  1817. &.mat-primary, &.mat-accent, &.mat-warn, &[disabled] {
  1818. &[disabled] {
  1819. $palette: if($property == 'color', $foreground, $background);
  1820. #{$property}: mat-color($palette, disabled-button);
  1821. }
  1822. }
  1823. }
  1824. @mixin mat-button-theme($theme) {
  1825. $primary: map-get($theme, primary);
  1826. $accent: map-get($theme, accent);
  1827. $warn: map-get($theme, warn);
  1828. $background: map-get($theme, background);
  1829. $foreground: map-get($theme, foreground);
  1830. .mat-button, .mat-icon-button, .mat-stroked-button {
  1831. // Buttons without a background color should inherit the font color. This is necessary to
  1832. // ensure that the button is readable on custom background colors. It's wrong to always assume
  1833. // that those buttons are always placed inside of containers with the default background
  1834. // color of the theme (e.g. themed toolbars).
  1835. color: inherit;
  1836. background: transparent;
  1837. @include _mat-button-theme-property($theme, 'color', text);
  1838. @include _mat-button-focus-overlay-color($theme);
  1839. // Setup the ripple color to be based on the text color. This ensures that the ripples
  1840. // are matching with the current theme palette and are in contrast to the background color
  1841. // (e.g in themed toolbars).
  1842. .mat-ripple-element {
  1843. opacity: $_mat-button-ripple-opacity;
  1844. background-color: currentColor;
  1845. }
  1846. }
  1847. .mat-button-focus-overlay {
  1848. background: map_get($foreground, base);
  1849. }
  1850. // Note: this needs a bit extra specificity, because we're not guaranteed the inclusion
  1851. // order of the theme styles and the button reset may end up resetting this as well.
  1852. .mat-stroked-button:not([disabled]) {
  1853. border-color: mat-color($foreground, divider);
  1854. }
  1855. .mat-flat-button, .mat-raised-button, .mat-fab, .mat-mini-fab {
  1856. // Default font and background color when not using any color palette.
  1857. color: mat-color($foreground, text);
  1858. background-color: mat-color($background, raised-button);
  1859. @include _mat-button-theme-property($theme, 'color', default-contrast);
  1860. @include _mat-button-theme-property($theme, 'background-color', default);
  1861. @include _mat-button-ripple-color($theme, default-contrast);
  1862. }
  1863. .mat-stroked-button, .mat-flat-button {
  1864. @include _mat-theme-overridable-elevation(0, $theme);
  1865. }
  1866. .mat-raised-button {
  1867. @include _mat-theme-overridable-elevation(2, $theme);
  1868. &:not([disabled]):active {
  1869. @include _mat-theme-overridable-elevation(8, $theme);
  1870. }
  1871. &[disabled] {
  1872. @include _mat-theme-overridable-elevation(0, $theme);
  1873. }
  1874. }
  1875. .mat-fab, .mat-mini-fab {
  1876. @include _mat-theme-overridable-elevation(6, $theme);
  1877. &:not([disabled]):active {
  1878. @include _mat-theme-overridable-elevation(12, $theme);
  1879. }
  1880. &[disabled] {
  1881. @include _mat-theme-overridable-elevation(0, $theme);
  1882. }
  1883. }
  1884. }
  1885. @mixin mat-button-typography($config) {
  1886. .mat-button, .mat-raised-button, .mat-icon-button, .mat-stroked-button,
  1887. .mat-flat-button, .mat-fab, .mat-mini-fab {
  1888. font: {
  1889. family: mat-font-family($config, button);
  1890. size: mat-font-size($config, button);
  1891. weight: mat-font-weight($config, button);
  1892. }
  1893. }
  1894. }
  1895. @mixin mat-button-toggle-theme($theme) {
  1896. $foreground: map-get($theme, foreground);
  1897. $background: map-get($theme, background);
  1898. $divider-color: mat-color($foreground, divider);
  1899. .mat-button-toggle-standalone,
  1900. .mat-button-toggle-group {
  1901. @include _mat-theme-elevation(2, $theme);
  1902. }
  1903. .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
  1904. .mat-button-toggle-group-appearance-standard {
  1905. box-shadow: none;
  1906. }
  1907. .mat-button-toggle {
  1908. color: mat-color($foreground, hint-text);
  1909. .mat-button-toggle-focus-overlay {
  1910. background-color: mat-color($background, focused-button);
  1911. }
  1912. }
  1913. .mat-button-toggle-appearance-standard {
  1914. color: mat-color($foreground, text);
  1915. background: mat-color($background, card);
  1916. .mat-button-toggle-focus-overlay {
  1917. background-color: mat-color($background, focused-button, 1);
  1918. }
  1919. }
  1920. .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
  1921. border-left: solid 1px $divider-color;
  1922. }
  1923. [dir='rtl'] .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
  1924. border-left: none;
  1925. border-right: solid 1px $divider-color;
  1926. }
  1927. .mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical {
  1928. .mat-button-toggle + .mat-button-toggle {
  1929. border-left: none;
  1930. border-right: none;
  1931. border-top: solid 1px $divider-color;
  1932. }
  1933. }
  1934. .mat-button-toggle-checked {
  1935. background-color: mat-color($background, selected-button);
  1936. color: mat-color($foreground, secondary-text);
  1937. &.mat-button-toggle-appearance-standard {
  1938. color: mat-color($foreground, text);
  1939. }
  1940. }
  1941. .mat-button-toggle-disabled {
  1942. color: mat-color($foreground, disabled-button);
  1943. background-color: mat-color($background, disabled-button-toggle);
  1944. &.mat-button-toggle-appearance-standard {
  1945. background: mat-color($background, card);
  1946. }
  1947. &.mat-button-toggle-checked {
  1948. background-color: mat-color($background, selected-disabled-button);
  1949. }
  1950. }
  1951. .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
  1952. .mat-button-toggle-group-appearance-standard {
  1953. border: solid 1px $divider-color;
  1954. }
  1955. }
  1956. @mixin mat-button-toggle-typography($config) {
  1957. .mat-button-toggle {
  1958. font-family: mat-font-family($config);
  1959. }
  1960. }
  1961. @mixin mat-card-theme($theme) {
  1962. $background: map-get($theme, background);
  1963. $foreground: map-get($theme, foreground);
  1964. .mat-card {
  1965. @include _mat-theme-overridable-elevation(1, $theme);
  1966. background: mat-color($background, card);
  1967. color: mat-color($foreground, text);
  1968. // Needs extra specificity to be able to override the elevation selectors.
  1969. &.mat-card-flat {
  1970. @include _mat-theme-overridable-elevation(0, $theme);
  1971. }
  1972. }
  1973. .mat-card-subtitle {
  1974. color: mat-color($foreground, secondary-text);
  1975. }
  1976. }
  1977. @mixin mat-card-typography($config) {
  1978. .mat-card {
  1979. font-family: mat-font-family($config);
  1980. }
  1981. .mat-card-title {
  1982. font: {
  1983. size: mat-font-size($config, headline);
  1984. weight: mat-font-weight($config, title);
  1985. }
  1986. }
  1987. .mat-card-header .mat-card-title {
  1988. font-size: mat-font-size($config, title);
  1989. }
  1990. .mat-card-subtitle,
  1991. .mat-card-content {
  1992. font-size: mat-font-size($config, body-1);
  1993. }
  1994. }
  1995. @mixin mat-checkbox-theme($theme) {
  1996. $is-dark-theme: map-get($theme, is-dark);
  1997. $primary: map-get($theme, primary);
  1998. $accent: map-get($theme, accent);
  1999. $warn: map-get($theme, warn);
  2000. $background: map-get($theme, background);
  2001. $foreground: map-get($theme, foreground);
  2002. // The color of the checkbox's checkmark / mixedmark.
  2003. $checkbox-mark-color: mat-color($background, background);
  2004. // NOTE(traviskaufman): While the spec calls for translucent blacks/whites for disabled colors,
  2005. // this does not work well with elements layered on top of one another. To get around this we
  2006. // blend the colors together based on the base color and the theme background.
  2007. $white-30pct-opacity-on-dark: #686868;
  2008. $black-26pct-opacity-on-light: #b0b0b0;
  2009. $disabled-color: if($is-dark-theme, $white-30pct-opacity-on-dark, $black-26pct-opacity-on-light);
  2010. .mat-checkbox-frame {
  2011. border-color: mat-color($foreground, secondary-text);
  2012. }
  2013. .mat-checkbox-checkmark {
  2014. fill: $checkbox-mark-color;
  2015. }
  2016. .mat-checkbox-checkmark-path {
  2017. // !important is needed here because a stroke must be set as an
  2018. // attribute on the SVG in order for line animation to work properly.
  2019. stroke: $checkbox-mark-color !important;
  2020. @include cdk-high-contrast(black-on-white) {
  2021. // Having the one above be !important ends up overriding the browser's automatic
  2022. // color inversion so we need to re-invert it ourselves for black-on-white.
  2023. stroke: #000 !important;
  2024. }
  2025. }
  2026. .mat-checkbox-mixedmark {
  2027. background-color: $checkbox-mark-color;
  2028. }
  2029. .mat-checkbox-indeterminate, .mat-checkbox-checked {
  2030. &.mat-primary .mat-checkbox-background {
  2031. background-color: mat-color($primary);
  2032. }
  2033. &.mat-accent .mat-checkbox-background {
  2034. background-color: mat-color($accent);
  2035. }
  2036. &.mat-warn .mat-checkbox-background {
  2037. background-color: mat-color($warn);
  2038. }
  2039. }
  2040. .mat-checkbox-disabled {
  2041. &.mat-checkbox-checked,
  2042. &.mat-checkbox-indeterminate {
  2043. .mat-checkbox-background {
  2044. background-color: $disabled-color;
  2045. }
  2046. }
  2047. &:not(.mat-checkbox-checked) {
  2048. .mat-checkbox-frame {
  2049. border-color: $disabled-color;
  2050. }
  2051. }
  2052. .mat-checkbox-label {
  2053. color: mat-color($foreground, secondary-text);
  2054. }
  2055. @include cdk-high-contrast {
  2056. opacity: 0.5;
  2057. }
  2058. }
  2059. // This one is moved down here so it can target both
  2060. // the theme colors and the disabled state.
  2061. @include cdk-high-contrast {
  2062. .mat-checkbox-background {
  2063. // Needs to be removed because it hides the checkbox outline.
  2064. background: none;
  2065. }
  2066. }
  2067. // Switch this to a solid color since we're using `opacity`
  2068. // to control how opaque the ripple should be.
  2069. .mat-checkbox .mat-ripple-element {
  2070. background-color: map_get(map-get($theme, foreground), base);
  2071. }
  2072. .mat-checkbox-checked:not(.mat-checkbox-disabled),
  2073. .mat-checkbox:active:not(.mat-checkbox-disabled) {
  2074. &.mat-primary .mat-ripple-element {
  2075. background: mat-color($primary);
  2076. }
  2077. &.mat-accent .mat-ripple-element {
  2078. background: mat-color($accent);
  2079. }
  2080. &.mat-warn .mat-ripple-element {
  2081. background: mat-color($warn);
  2082. }
  2083. }
  2084. }
  2085. @mixin mat-checkbox-typography($config) {
  2086. .mat-checkbox {
  2087. font-family: mat-font-family($config);
  2088. }
  2089. // TODO(kara): Remove this style when fixing vertical baseline
  2090. .mat-checkbox-layout .mat-checkbox-label {
  2091. line-height: mat-line-height($config, body-2);
  2092. }
  2093. }
  2094. $mat-chip-remove-font-size: 18px;
  2095. @mixin mat-chips-color($foreground, $background) {
  2096. background-color: $background;
  2097. color: $foreground;
  2098. .mat-chip-remove {
  2099. color: $foreground;
  2100. opacity: 0.4;
  2101. }
  2102. }
  2103. @mixin mat-chips-theme-color($palette) {
  2104. @include mat-chips-color(mat-color($palette, default-contrast), mat-color($palette));
  2105. .mat-ripple-element {
  2106. background: mat-color($palette, default-contrast, 0.1);
  2107. }
  2108. }
  2109. @mixin mat-chips-theme($theme) {
  2110. $is-dark-theme: map-get($theme, is-dark);
  2111. $primary: map-get($theme, primary);
  2112. $accent: map-get($theme, accent);
  2113. $warn: map-get($theme, warn);
  2114. $background: map-get($theme, background);
  2115. $foreground: map-get($theme, foreground);
  2116. $unselected-background: mat-color($background, unselected-chip);
  2117. $unselected-foreground: mat-color($foreground, text);
  2118. .mat-chip.mat-standard-chip {
  2119. @include mat-chips-color($unselected-foreground, $unselected-background);
  2120. &:not(.mat-chip-disabled) {
  2121. &:active {
  2122. @include _mat-theme-elevation(3, $theme);
  2123. }
  2124. .mat-chip-remove:hover {
  2125. opacity: 0.54;
  2126. }
  2127. }
  2128. &.mat-chip-disabled {
  2129. opacity: 0.4;
  2130. }
  2131. &::after {
  2132. background: map_get($foreground, base);
  2133. }
  2134. }
  2135. .mat-chip.mat-standard-chip.mat-chip-selected {
  2136. &.mat-primary {
  2137. @include mat-chips-theme-color($primary);
  2138. }
  2139. &.mat-warn {
  2140. @include mat-chips-theme-color($warn);
  2141. }
  2142. &.mat-accent {
  2143. @include mat-chips-theme-color($accent);
  2144. }
  2145. }
  2146. }
  2147. @mixin mat-chips-typography($config) {
  2148. .mat-chip {
  2149. font-size: mat-font-size($config, body-2);
  2150. font-weight: mat-font-weight($config, body-2);
  2151. .mat-chip-trailing-icon.mat-icon,
  2152. .mat-chip-remove.mat-icon {
  2153. font-size: $mat-chip-remove-font-size;
  2154. }
  2155. }
  2156. }
  2157. @mixin mat-table-theme($theme) {
  2158. $background: map-get($theme, background);
  2159. $foreground: map-get($theme, foreground);
  2160. .mat-table {
  2161. background: mat-color($background, 'card');
  2162. }
  2163. .mat-table thead, .mat-table tbody, .mat-table tfoot,
  2164. mat-header-row, mat-row, mat-footer-row,
  2165. [mat-header-row], [mat-row], [mat-footer-row],
  2166. .mat-table-sticky {
  2167. background: inherit;
  2168. }
  2169. mat-row, mat-header-row, mat-footer-row,
  2170. th.mat-header-cell, td.mat-cell, td.mat-footer-cell {
  2171. border-bottom-color: mat-color($foreground, divider);
  2172. }
  2173. .mat-header-cell {
  2174. color: mat-color($foreground, secondary-text);
  2175. }
  2176. .mat-cell, .mat-footer-cell {
  2177. color: mat-color($foreground, text);
  2178. }
  2179. }
  2180. @mixin mat-table-typography($config) {
  2181. .mat-table {
  2182. font-family: mat-font-family($config);
  2183. }
  2184. .mat-header-cell {
  2185. font-size: mat-font-size($config, caption);
  2186. font-weight: mat-font-weight($config, body-2);
  2187. }
  2188. .mat-cell, .mat-footer-cell {
  2189. font-size: mat-font-size($config, body-1);
  2190. }
  2191. }
  2192. $mat-datepicker-selected-today-box-shadow-width: 1px;
  2193. $mat-datepicker-selected-fade-amount: 0.6;
  2194. $mat-datepicker-today-fade-amount: 0.2;
  2195. $mat-calendar-body-font-size: 13px !default;
  2196. $mat-calendar-weekday-table-font-size: 11px !default;
  2197. @mixin _mat-datepicker-color($palette) {
  2198. .mat-calendar-body-selected {
  2199. background-color: mat-color($palette);
  2200. color: mat-color($palette, default-contrast);
  2201. }
  2202. .mat-calendar-body-disabled > .mat-calendar-body-selected {
  2203. $background: mat-color($palette);
  2204. @if (type-of($background) == color) {
  2205. background-color: fade-out($background, $mat-datepicker-selected-fade-amount);
  2206. }
  2207. @else {
  2208. // If we couldn't resolve to background to a color (e.g. it's a CSS variable),
  2209. // fall back to fading the content out via `opacity`.
  2210. opacity: $mat-datepicker-today-fade-amount;
  2211. }
  2212. }
  2213. .mat-calendar-body-today.mat-calendar-body-selected {
  2214. box-shadow: inset 0 0 0 $mat-datepicker-selected-today-box-shadow-width
  2215. mat-color($palette, default-contrast);
  2216. }
  2217. }
  2218. @mixin mat-datepicker-theme($theme) {
  2219. $foreground: map-get($theme, foreground);
  2220. $background: map-get($theme, background);
  2221. .mat-calendar-arrow {
  2222. border-top-color: mat-color($foreground, icon);
  2223. }
  2224. // The prev/next buttons need a bit more specificity to
  2225. // avoid being overwritten by the .mat-icon-button.
  2226. .mat-datepicker-toggle,
  2227. .mat-datepicker-content .mat-calendar-next-button,
  2228. .mat-datepicker-content .mat-calendar-previous-button {
  2229. color: mat-color($foreground, icon);
  2230. }
  2231. .mat-calendar-table-header {
  2232. color: mat-color($foreground, hint-text);
  2233. }
  2234. .mat-calendar-table-header-divider::after {
  2235. background: mat-color($foreground, divider);
  2236. }
  2237. .mat-calendar-body-label {
  2238. color: mat-color($foreground, secondary-text);
  2239. }
  2240. .mat-calendar-body-cell-content {
  2241. color: mat-color($foreground, text);
  2242. border-color: transparent;
  2243. }
  2244. .mat-calendar-body-disabled > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected) {
  2245. color: mat-color($foreground, disabled-text);
  2246. }
  2247. .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover,
  2248. .cdk-keyboard-focused .mat-calendar-body-active,
  2249. .cdk-program-focused .mat-calendar-body-active {
  2250. & > .mat-calendar-body-cell-content:not(.mat-calendar-body-selected) {
  2251. background-color: mat-color($background, hover);
  2252. }
  2253. }
  2254. .mat-calendar-body-today:not(.mat-calendar-body-selected) {
  2255. // Note: though it's not text, the border is a hint about the fact that this is today's date,
  2256. // so we use the hint color.
  2257. border-color: mat-color($foreground, hint-text);
  2258. }
  2259. .mat-calendar-body-disabled > .mat-calendar-body-today:not(.mat-calendar-body-selected) {
  2260. $color: mat-color($foreground, hint-text);
  2261. @if (type-of($color) == color) {
  2262. border-color: fade-out($color, $mat-datepicker-today-fade-amount);
  2263. }
  2264. @else {
  2265. // If the color didn't resolve to a color value, but something like a CSS variable, we can't
  2266. // fade it out so we fall back to reducing the element opacity. Note that we don't use the
  2267. // $mat-datepicker-today-fade-amount, because hint text usually has some opacity applied
  2268. // to it already and we don't want them to stack on top of each other.
  2269. opacity: 0.5;
  2270. }
  2271. }
  2272. @include _mat-datepicker-color(map-get($theme, primary));
  2273. .mat-datepicker-content {
  2274. @include _mat-theme-elevation(4, $theme);
  2275. background-color: mat-color($background, card);
  2276. color: mat-color($foreground, text);
  2277. &.mat-accent {
  2278. @include _mat-datepicker-color(map-get($theme, accent));
  2279. }
  2280. &.mat-warn {
  2281. @include _mat-datepicker-color(map-get($theme, warn));
  2282. }
  2283. }
  2284. .mat-datepicker-content-touch {
  2285. @include _mat-theme-elevation(0, $theme);
  2286. }
  2287. .mat-datepicker-toggle-active {
  2288. color: mat-color(map-get($theme, primary), text);
  2289. &.mat-accent {
  2290. color: mat-color(map-get($theme, accent), text);
  2291. }
  2292. &.mat-warn {
  2293. color: mat-color(map-get($theme, warn), text);
  2294. }
  2295. }
  2296. }
  2297. @mixin mat-datepicker-typography($config) {
  2298. .mat-calendar {
  2299. font-family: mat-font-family($config);
  2300. }
  2301. .mat-calendar-body {
  2302. font-size: $mat-calendar-body-font-size;
  2303. }
  2304. .mat-calendar-body-label,
  2305. .mat-calendar-period-button {
  2306. font: {
  2307. size: mat-font-size($config, button);
  2308. weight: mat-font-weight($config, button);
  2309. }
  2310. }
  2311. .mat-calendar-table-header th {
  2312. font: {
  2313. size: $mat-calendar-weekday-table-font-size;
  2314. weight: mat-font-weight($config, body-1);
  2315. }
  2316. }
  2317. }
  2318. @mixin mat-dialog-theme($theme) {
  2319. $background: map-get($theme, background);
  2320. $foreground: map-get($theme, foreground);
  2321. .mat-dialog-container {
  2322. @include _mat-theme-elevation(24, $theme);
  2323. background: mat-color($background, dialog);
  2324. color: mat-color($foreground, text);
  2325. }
  2326. }
  2327. @mixin mat-dialog-typography($config) {
  2328. .mat-dialog-title {
  2329. @include mat-typography-level-to-styles($config, title);
  2330. }
  2331. }
  2332. @mixin mat-expansion-panel-theme($theme) {
  2333. $background: map-get($theme, background);
  2334. $foreground: map-get($theme, foreground);
  2335. .mat-expansion-panel {
  2336. @include _mat-theme-overridable-elevation(2, $theme);
  2337. background: mat-color($background, card);
  2338. color: mat-color($foreground, text);
  2339. }
  2340. .mat-action-row {
  2341. border-top-color: mat-color($foreground, divider);
  2342. }
  2343. .mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header {
  2344. &:not([aria-disabled='true']) {
  2345. &.cdk-keyboard-focused,
  2346. &.cdk-program-focused,
  2347. &:hover {
  2348. background: mat-color($background, hover);
  2349. }
  2350. }
  2351. }
  2352. // Disable the hover on touch devices since it can appear like it is stuck. We can't use
  2353. // `@media (hover)` above, because the desktop support browser support isn't great.
  2354. @media (hover: none) {
  2355. .mat-expansion-panel:not(.mat-expanded):not([aria-disabled='true'])
  2356. .mat-expansion-panel-header:hover {
  2357. background: mat-color($background, card);
  2358. }
  2359. }
  2360. .mat-expansion-panel-header-title {
  2361. color: mat-color($foreground, text);
  2362. }
  2363. .mat-expansion-panel-header-description,
  2364. .mat-expansion-indicator::after {
  2365. color: mat-color($foreground, secondary-text);
  2366. }
  2367. .mat-expansion-panel-header[aria-disabled='true'] {
  2368. color: mat-color($foreground, disabled-button);
  2369. .mat-expansion-panel-header-title,
  2370. .mat-expansion-panel-header-description {
  2371. color: inherit;
  2372. }
  2373. }
  2374. }
  2375. @mixin mat-expansion-panel-typography($config) {
  2376. .mat-expansion-panel-header {
  2377. font: {
  2378. family: mat-font-family($config, subheading-1);
  2379. size: mat-font-size($config, subheading-1);
  2380. weight: mat-font-weight($config, subheading-1);
  2381. }
  2382. }
  2383. .mat-expansion-panel-content {
  2384. @include mat-typography-level-to-styles($config, body-1);
  2385. }
  2386. }
  2387. // This mixin will ensure that lines that overflow the container will hide the overflow and
  2388. // truncate neatly with an ellipsis.
  2389. @mixin mat-truncate-line() {
  2390. white-space: nowrap;
  2391. overflow: hidden;
  2392. text-overflow: ellipsis;
  2393. }
  2394. // Mixin to provide all mat-line styles, changing secondary font size based on whether the list
  2395. // is in dense mode.
  2396. @mixin mat-line-base($secondary-font-size) {
  2397. .mat-line {
  2398. @include mat-truncate-line();
  2399. display: block;
  2400. box-sizing: border-box;
  2401. // all lines but the top line should have smaller text
  2402. &:nth-child(n+2) {
  2403. font-size: $secondary-font-size;
  2404. }
  2405. }
  2406. }
  2407. // This mixin normalizes default element styles, e.g. font weight for heading text.
  2408. @mixin mat-normalize-text() {
  2409. & > * {
  2410. margin: 0;
  2411. padding: 0;
  2412. font-weight: normal;
  2413. font-size: inherit;
  2414. }
  2415. }
  2416. // This mixin provides base styles for the wrapper around mat-line elements in a list.
  2417. @mixin mat-line-wrapper-base() {
  2418. @include mat-normalize-text();
  2419. display: flex;
  2420. flex-direction: column;
  2421. width: 100%;
  2422. box-sizing: border-box;
  2423. overflow: hidden;
  2424. // Must remove wrapper when lines are empty or it takes up horizontal
  2425. // space and pushes other elements to the right.
  2426. &:empty {
  2427. display: none;
  2428. }
  2429. }
  2430. // Include this empty mixin for consistency with the other components.
  2431. @mixin mat-grid-list-theme($theme) { }
  2432. @mixin mat-grid-list-typography($config) {
  2433. .mat-grid-tile-header,
  2434. .mat-grid-tile-footer {
  2435. @include mat-line-base(mat-font-size($config, caption));
  2436. font-size: mat-font-size($config, body-1);
  2437. }
  2438. }
  2439. // Include this empty mixin for consistency with the other components.
  2440. @mixin mat-icon-theme($theme) {
  2441. $primary: map-get($theme, primary);
  2442. $accent: map-get($theme, accent);
  2443. $warn: map-get($theme, warn);
  2444. $background: map-get($theme, background);
  2445. $foreground: map-get($theme, foreground);
  2446. .mat-icon {
  2447. &.mat-primary {
  2448. color: mat-color($primary, text);
  2449. }
  2450. &.mat-accent {
  2451. color: mat-color($accent, text);
  2452. }
  2453. &.mat-warn {
  2454. color: mat-color($warn, text);
  2455. }
  2456. }
  2457. }
  2458. @mixin mat-icon-typography($config) { }
  2459. // Renders a gradient for showing the dashed line when the input is disabled.
  2460. // Unlike using a border, a gradient allows us to adjust the spacing of the dotted line
  2461. // to match the Material Design spec.
  2462. @mixin mat-control-disabled-underline($color) {
  2463. background-image: linear-gradient(to right, $color 0%, $color 33%, transparent 0%);
  2464. background-size: 4px 100%;
  2465. background-repeat: repeat-x;
  2466. }
  2467. // Figures out the color of the placeholder for a form control.
  2468. // Used primarily to prevent the various form controls from
  2469. // becoming out of sync since these colors aren't in a palette.
  2470. @function _mat-control-placeholder-color($theme) {
  2471. $foreground: map-get($theme, foreground);
  2472. $is-dark-theme: map-get($theme, is-dark);
  2473. @return mat-color($foreground, secondary-text, if($is-dark-theme, 0.5, 0.42));
  2474. }
  2475. /* stylelint-disable material/no-prefixes */
  2476. @mixin user-select($value) {
  2477. -webkit-user-select: $value;
  2478. -moz-user-select: $value;
  2479. -ms-user-select: $value;
  2480. user-select: $value;
  2481. }
  2482. @mixin input-placeholder {
  2483. &::placeholder {
  2484. @content;
  2485. }
  2486. &::-moz-placeholder {
  2487. @content;
  2488. }
  2489. &::-webkit-input-placeholder {
  2490. @content;
  2491. }
  2492. &:-ms-input-placeholder {
  2493. @content;
  2494. }
  2495. }
  2496. @mixin cursor-grab {
  2497. cursor: -webkit-grab;
  2498. cursor: grab;
  2499. }
  2500. @mixin cursor-grabbing {
  2501. cursor: -webkit-grabbing;
  2502. cursor: grabbing;
  2503. }
  2504. @mixin backface-visibility($value) {
  2505. -webkit-backface-visibility: $value;
  2506. backface-visibility: $value;
  2507. }
  2508. /* stylelint-enable */
  2509. @mixin mat-input-theme($theme) {
  2510. $primary: map-get($theme, primary);
  2511. $accent: map-get($theme, accent);
  2512. $warn: map-get($theme, warn);
  2513. $foreground: map-get($theme, foreground);
  2514. .mat-form-field-type-mat-native-select .mat-form-field-infix::after {
  2515. color: mat-color($foreground, secondary-text);
  2516. }
  2517. .mat-input-element:disabled,
  2518. .mat-form-field-type-mat-native-select.mat-form-field-disabled .mat-form-field-infix::after {
  2519. color: mat-color($foreground, disabled-text);
  2520. }
  2521. .mat-input-element {
  2522. caret-color: mat-color($primary, text);
  2523. @include input-placeholder {
  2524. color: _mat-control-placeholder-color($theme);
  2525. }
  2526. // On dark themes we set the native `select` color to some shade of white,
  2527. // however the color propagates to all of the `option` elements, which are
  2528. // always on a white background inside the dropdown, causing them to blend in.
  2529. // Since we can't change background of the dropdown, we need to explicitly
  2530. // reset the color of the options to something dark.
  2531. @if (map-get($theme, is-dark)) {
  2532. option {
  2533. color: $dark-primary-text;
  2534. }
  2535. option:disabled {
  2536. color: $dark-disabled-text;
  2537. }
  2538. }
  2539. }
  2540. .mat-accent .mat-input-element {
  2541. caret-color: mat-color($accent, text);
  2542. }
  2543. .mat-warn .mat-input-element,
  2544. .mat-form-field-invalid .mat-input-element {
  2545. caret-color: mat-color($warn, text);
  2546. }
  2547. .mat-form-field-type-mat-native-select.mat-form-field-invalid .mat-form-field-infix::after {
  2548. color: mat-color($warn, text);
  2549. }
  2550. }
  2551. @mixin mat-input-typography($config) {
  2552. // The unit-less line-height from the font config.
  2553. $line-height: mat-line-height($config, input);
  2554. // The amount of space between the top of the line and the top of the actual text
  2555. // (as a fraction of the font-size).
  2556. $line-spacing: ($line-height - 1) / 2;
  2557. // <input> elements seem to have their height set slightly too large on Safari causing the text to
  2558. // be misaligned w.r.t. the placeholder. Adding this margin corrects it.
  2559. input.mat-input-element {
  2560. margin-top: -$line-spacing * 1em;
  2561. }
  2562. }
  2563. @mixin mat-list-theme($theme) {
  2564. $background: map-get($theme, background);
  2565. $foreground: map-get($theme, foreground);
  2566. .mat-list-base {
  2567. .mat-list-item {
  2568. color: mat-color($foreground, text);
  2569. }
  2570. .mat-list-option {
  2571. color: mat-color($foreground, text);
  2572. }
  2573. .mat-subheader {
  2574. color: mat-color($foreground, secondary-text);
  2575. }
  2576. }
  2577. .mat-list-item-disabled {
  2578. background-color: mat-color($background, disabled-list-option);
  2579. }
  2580. .mat-list-option,
  2581. .mat-nav-list .mat-list-item,
  2582. .mat-action-list .mat-list-item {
  2583. &:hover, &:focus {
  2584. background: mat-color($background, 'hover');
  2585. }
  2586. }
  2587. }
  2588. @mixin mat-list-typography($config) {
  2589. $font-family: mat-font-family($config);
  2590. .mat-list-item {
  2591. font-family: $font-family;
  2592. }
  2593. .mat-list-option {
  2594. font-family: $font-family;
  2595. }
  2596. // Default list
  2597. .mat-list-base {
  2598. .mat-list-item {
  2599. font-size: mat-font-size($config, subheading-2);
  2600. @include mat-line-base(mat-font-size($config, body-1));
  2601. }
  2602. .mat-list-option {
  2603. font-size: mat-font-size($config, subheading-2);
  2604. @include mat-line-base(mat-font-size($config, body-1));
  2605. }
  2606. .mat-subheader {
  2607. font-family: mat-font-family($config, body-2);
  2608. font-size: mat-font-size($config, body-2);
  2609. font-weight: mat-font-weight($config, body-2);
  2610. }
  2611. }
  2612. // Dense list
  2613. .mat-list-base[dense] {
  2614. .mat-list-item {
  2615. font-size: mat-font-size($config, caption);
  2616. @include mat-line-base(mat-font-size($config, caption));
  2617. }
  2618. .mat-list-option {
  2619. font-size: mat-font-size($config, caption);
  2620. @include mat-line-base(mat-font-size($config, caption));
  2621. }
  2622. .mat-subheader {
  2623. font-family: $font-family;
  2624. font-size: mat-font-size($config, caption);
  2625. font-weight: mat-font-weight($config, body-2);
  2626. }
  2627. }
  2628. }
  2629. @mixin mat-menu-theme($theme) {
  2630. $background: map-get($theme, background);
  2631. $foreground: map-get($theme, foreground);
  2632. .mat-menu-panel {
  2633. @include _mat-theme-overridable-elevation(4, $theme);
  2634. background: mat-color($background, 'card');
  2635. }
  2636. .mat-menu-item {
  2637. background: transparent;
  2638. color: mat-color($foreground, 'text');
  2639. &[disabled] {
  2640. &, &::after {
  2641. color: mat-color($foreground, 'disabled');
  2642. }
  2643. }
  2644. }
  2645. .mat-menu-item .mat-icon-no-color,
  2646. .mat-menu-item-submenu-trigger::after {
  2647. color: mat-color($foreground, 'icon');
  2648. }
  2649. .mat-menu-item:hover,
  2650. .mat-menu-item.cdk-program-focused,
  2651. .mat-menu-item.cdk-keyboard-focused,
  2652. .mat-menu-item-highlighted {
  2653. &:not([disabled]) {
  2654. background: mat-color($background, 'hover');
  2655. }
  2656. }
  2657. }
  2658. @mixin mat-menu-typography($config) {
  2659. .mat-menu-item {
  2660. font: {
  2661. family: mat-font-family($config, body-1);
  2662. size: mat-font-size($config, body-1);
  2663. weight: mat-font-weight($config, body-1);
  2664. }
  2665. }
  2666. }
  2667. @mixin mat-paginator-theme($theme) {
  2668. $foreground: map-get($theme, foreground);
  2669. $background: map-get($theme, background);
  2670. .mat-paginator {
  2671. background: mat-color($background, 'card');
  2672. }
  2673. .mat-paginator,
  2674. .mat-paginator-page-size .mat-select-trigger {
  2675. color: mat-color($foreground, secondary-text);
  2676. }
  2677. .mat-paginator-decrement,
  2678. .mat-paginator-increment {
  2679. border-top: 2px solid mat-color($foreground, 'icon');
  2680. border-right: 2px solid mat-color($foreground, 'icon');
  2681. }
  2682. .mat-paginator-first,
  2683. .mat-paginator-last {
  2684. border-top: 2px solid mat-color($foreground, 'icon');
  2685. }
  2686. .mat-icon-button[disabled] {
  2687. .mat-paginator-decrement,
  2688. .mat-paginator-increment,
  2689. .mat-paginator-first,
  2690. .mat-paginator-last {
  2691. border-color: mat-color($foreground, 'disabled');
  2692. }
  2693. }
  2694. }
  2695. @mixin mat-paginator-typography($config) {
  2696. .mat-paginator,
  2697. .mat-paginator-page-size .mat-select-trigger {
  2698. font: {
  2699. family: mat-font-family($config, caption);
  2700. size: mat-font-size($config, caption);
  2701. }
  2702. }
  2703. }
  2704. @mixin mat-progress-bar-theme($theme) {
  2705. $primary: map-get($theme, primary);
  2706. $accent: map-get($theme, accent);
  2707. $warn: map-get($theme, warn);
  2708. .mat-progress-bar-background {
  2709. fill: mat-color($primary, lighter);
  2710. }
  2711. .mat-progress-bar-buffer {
  2712. background-color: mat-color($primary, lighter);
  2713. }
  2714. .mat-progress-bar-fill::after {
  2715. background-color: mat-color($primary);
  2716. }
  2717. .mat-progress-bar.mat-accent {
  2718. .mat-progress-bar-background {
  2719. fill: mat-color($accent, lighter);
  2720. }
  2721. .mat-progress-bar-buffer {
  2722. background-color: mat-color($accent, lighter);
  2723. }
  2724. .mat-progress-bar-fill::after {
  2725. background-color: mat-color($accent);
  2726. }
  2727. }
  2728. .mat-progress-bar.mat-warn {
  2729. .mat-progress-bar-background {
  2730. fill: mat-color($warn, lighter);
  2731. }
  2732. .mat-progress-bar-buffer {
  2733. background-color: mat-color($warn, lighter);
  2734. }
  2735. .mat-progress-bar-fill::after {
  2736. background-color: mat-color($warn);
  2737. }
  2738. }
  2739. }
  2740. @mixin mat-progress-bar-typography($config) { }
  2741. @mixin mat-progress-spinner-theme($theme) {
  2742. $primary: map-get($theme, primary);
  2743. $accent: map-get($theme, accent);
  2744. $warn: map-get($theme, warn);
  2745. .mat-progress-spinner, .mat-spinner {
  2746. circle {
  2747. stroke: mat-color($primary);
  2748. }
  2749. &.mat-accent circle {
  2750. stroke: mat-color($accent);
  2751. }
  2752. &.mat-warn circle {
  2753. stroke: mat-color($warn);
  2754. }
  2755. }
  2756. }
  2757. @mixin mat-progress-spinner-typography($config) { }
  2758. @mixin _mat-radio-color($palette) {
  2759. &.mat-radio-checked .mat-radio-outer-circle {
  2760. border-color: mat-color($palette);
  2761. }
  2762. .mat-radio-inner-circle,
  2763. .mat-radio-ripple .mat-ripple-element:not(.mat-radio-persistent-ripple),
  2764. &.mat-radio-checked .mat-radio-persistent-ripple,
  2765. &:active .mat-radio-persistent-ripple {
  2766. background-color: mat-color($palette);
  2767. }
  2768. }
  2769. @mixin mat-radio-theme($theme) {
  2770. $primary: map-get($theme, primary);
  2771. $accent: map-get($theme, accent);
  2772. $warn: map-get($theme, warn);
  2773. $background: map-get($theme, background);
  2774. $foreground: map-get($theme, foreground);
  2775. .mat-radio-outer-circle {
  2776. border-color: mat-color($foreground, secondary-text);
  2777. }
  2778. .mat-radio-button {
  2779. &.mat-primary {
  2780. @include _mat-radio-color($primary);
  2781. }
  2782. &.mat-accent {
  2783. @include _mat-radio-color($accent);
  2784. }
  2785. &.mat-warn {
  2786. @include _mat-radio-color($warn);
  2787. }
  2788. // This needs extra specificity, because the classes above are combined
  2789. // (e.g. `.mat-radio-button.mat-accent`) which increases their specificity a lot.
  2790. // TODO: consider making the selectors into descendants (`.mat-primary .mat-radio-button`).
  2791. &.mat-radio-disabled {
  2792. &.mat-radio-checked .mat-radio-outer-circle,
  2793. .mat-radio-outer-circle {
  2794. border-color: mat-color($foreground, disabled);
  2795. }
  2796. .mat-radio-ripple .mat-ripple-element,
  2797. .mat-radio-inner-circle {
  2798. background-color: mat-color($foreground, disabled);
  2799. }
  2800. .mat-radio-label-content {
  2801. color: mat-color($foreground, disabled);
  2802. }
  2803. }
  2804. // Switch this to a solid color since we're using `opacity`
  2805. // to control how opaque the ripple should be.
  2806. .mat-ripple-element {
  2807. background-color: map_get($foreground, base);
  2808. }
  2809. }
  2810. }
  2811. @mixin mat-radio-typography($config) {
  2812. .mat-radio-button {
  2813. font-family: mat-font-family($config);
  2814. }
  2815. }
  2816. @mixin mat-select-theme($theme) {
  2817. $foreground: map-get($theme, foreground);
  2818. $background: map-get($theme, background);
  2819. $primary: map-get($theme, primary);
  2820. $accent: map-get($theme, accent);
  2821. $warn: map-get($theme, warn);
  2822. .mat-select-value {
  2823. color: mat-color($foreground, text);
  2824. }
  2825. .mat-select-placeholder {
  2826. color: _mat-control-placeholder-color($theme);
  2827. }
  2828. .mat-select-disabled .mat-select-value {
  2829. color: mat-color($foreground, disabled-text);
  2830. }
  2831. .mat-select-arrow {
  2832. color: mat-color($foreground, secondary-text);
  2833. }
  2834. .mat-select-panel {
  2835. background: mat-color($background, card);
  2836. @include _mat-theme-overridable-elevation(4, $theme);
  2837. .mat-option.mat-selected:not(.mat-option-multiple) {
  2838. background: mat-color($background, hover, 0.12);
  2839. }
  2840. }
  2841. .mat-form-field {
  2842. &.mat-focused {
  2843. &.mat-primary .mat-select-arrow {
  2844. color: mat-color($primary, text);
  2845. }
  2846. &.mat-accent .mat-select-arrow {
  2847. color: mat-color($accent, text);
  2848. }
  2849. &.mat-warn .mat-select-arrow {
  2850. color: mat-color($warn, text);
  2851. }
  2852. }
  2853. .mat-select.mat-select-invalid .mat-select-arrow {
  2854. color: mat-color($warn, text);
  2855. }
  2856. .mat-select.mat-select-disabled .mat-select-arrow {
  2857. color: mat-color($foreground, disabled-text);
  2858. }
  2859. }
  2860. }
  2861. @mixin mat-select-typography($config) {
  2862. // The unit-less line-height from the font config.
  2863. $line-height: mat-line-height($config, input);
  2864. .mat-select {
  2865. font-family: mat-font-family($config);
  2866. }
  2867. .mat-select-trigger {
  2868. height: $line-height * 1em;
  2869. }
  2870. }
  2871. @mixin mat-sidenav-theme($theme) {
  2872. $primary: map-get($theme, primary);
  2873. $accent: map-get($theme, accent);
  2874. $warn: map-get($theme, warn);
  2875. $background: map-get($theme, background);
  2876. $foreground: map-get($theme, foreground);
  2877. $drawer-background-color: mat-color($background, dialog);
  2878. $drawer-container-background-color: mat-color($background, background);
  2879. $drawer-push-background-color: mat-color($background, dialog);
  2880. $drawer-side-border: solid 1px mat-color($foreground, divider);
  2881. .mat-drawer-container {
  2882. background-color: $drawer-container-background-color;
  2883. color: mat-color($foreground, text);
  2884. }
  2885. .mat-drawer {
  2886. background-color: $drawer-background-color;
  2887. color: mat-color($foreground, text);
  2888. &.mat-drawer-push {
  2889. background-color: $drawer-push-background-color;
  2890. }
  2891. &:not(.mat-drawer-side) {
  2892. // The elevation of z-16 is noted in the design specifications.
  2893. // See https://material.io/design/components/navigation-drawer.html
  2894. @include _mat-theme-elevation(16, $theme);
  2895. }
  2896. }
  2897. .mat-drawer-side {
  2898. border-right: $drawer-side-border;
  2899. &.mat-drawer-end {
  2900. border-left: $drawer-side-border;
  2901. border-right: none;
  2902. }
  2903. }
  2904. [dir='rtl'] .mat-drawer-side {
  2905. border-left: $drawer-side-border;
  2906. border-right: none;
  2907. &.mat-drawer-end {
  2908. border-left: none;
  2909. border-right: $drawer-side-border;
  2910. }
  2911. }
  2912. .mat-drawer-backdrop.mat-drawer-shown {
  2913. $opacity: 0.6;
  2914. $backdrop-color: mat-color($background, card, $opacity);
  2915. @if (type-of($backdrop-color) == color) {
  2916. // We use invert() here to have the darken the background color expected to be used. If the
  2917. // background is light, we use a dark backdrop. If the background is dark,
  2918. // we use a light backdrop.
  2919. background-color: invert($backdrop-color);
  2920. }
  2921. @else {
  2922. // If we couldn't resolve the backdrop color to a color value, fall back to using
  2923. // `opacity` to make it opaque since its end value could be a solid color.
  2924. background-color: $backdrop-color;
  2925. opacity: $opacity;
  2926. }
  2927. }
  2928. }
  2929. @mixin mat-sidenav-typography($config) { }
  2930. @mixin _mat-slide-toggle-checked($palette, $thumb-checked-hue) {
  2931. &.mat-checked {
  2932. .mat-slide-toggle-thumb {
  2933. background-color: mat-color($palette, $thumb-checked-hue);
  2934. }
  2935. .mat-slide-toggle-bar {
  2936. // Opacity is determined from the specs for the selection controls.
  2937. // See: https://material.io/design/components/selection-controls.html#specs
  2938. background-color: mat-color($palette, $thumb-checked-hue, 0.54);
  2939. }
  2940. .mat-ripple-element {
  2941. // Set no opacity for the ripples because the ripple opacity will be adjusted dynamically
  2942. // based on the type of interaction with the slide-toggle (e.g. for hover, focus)
  2943. background-color: mat-color($palette, $thumb-checked-hue);
  2944. }
  2945. }
  2946. }
  2947. @mixin mat-slide-toggle-theme($theme) {
  2948. $is-dark: map_get($theme, is-dark);
  2949. $primary: map-get($theme, primary);
  2950. $accent: map-get($theme, accent);
  2951. $warn: map-get($theme, warn);
  2952. $background: map-get($theme, background);
  2953. $foreground: map-get($theme, foreground);
  2954. // Color hues are based on the specs which briefly show the hues that are applied to a switch.
  2955. // The 2018 specs no longer describe how dark switches should look like. Due to the lack of
  2956. // information for dark themed switches, we partially keep the old behavior that is based on
  2957. // the previous specifications. For the checked color we always use the `default` hue because
  2958. // that follows MDC and also makes it easier for people to create a custom theme without needing
  2959. // to specify each hue individually.
  2960. $thumb-unchecked-hue: if($is-dark, 400, 50);
  2961. $thumb-checked-hue: default;
  2962. $bar-unchecked-color: mat-color($foreground, disabled);
  2963. $ripple-unchecked-color: mat-color($foreground, base);
  2964. .mat-slide-toggle {
  2965. @include _mat-slide-toggle-checked($accent, $thumb-checked-hue);
  2966. &.mat-primary {
  2967. @include _mat-slide-toggle-checked($primary, $thumb-checked-hue);
  2968. }
  2969. &.mat-warn {
  2970. @include _mat-slide-toggle-checked($warn, $thumb-checked-hue);
  2971. }
  2972. &:not(.mat-checked) .mat-ripple-element {
  2973. // Set no opacity for the ripples because the ripple opacity will be adjusted dynamically
  2974. // based on the type of interaction with the slide-toggle (e.g. for hover, focus)
  2975. background-color: $ripple-unchecked-color;
  2976. }
  2977. }
  2978. .mat-slide-toggle-thumb {
  2979. @include _mat-theme-elevation(1, $theme);
  2980. background-color: mat-color($mat-grey, $thumb-unchecked-hue);
  2981. }
  2982. .mat-slide-toggle-bar {
  2983. background-color: $bar-unchecked-color;
  2984. }
  2985. }
  2986. @mixin mat-slide-toggle-typography($config) {
  2987. .mat-slide-toggle-content {
  2988. font-family: mat-font-family($config);
  2989. }
  2990. }
  2991. @mixin _mat-slider-inner-content-theme($palette) {
  2992. .mat-slider-track-fill,
  2993. .mat-slider-thumb,
  2994. .mat-slider-thumb-label {
  2995. background-color: mat-color($palette);
  2996. }
  2997. .mat-slider-thumb-label-text {
  2998. color: mat-color($palette, default-contrast);
  2999. }
  3000. }
  3001. @mixin mat-slider-theme($theme) {
  3002. $primary: map-get($theme, primary);
  3003. $accent: map-get($theme, accent);
  3004. $warn: map-get($theme, warn);
  3005. $background: map-get($theme, background);
  3006. $foreground: map-get($theme, foreground);
  3007. $mat-slider-off-color: mat-color($foreground, slider-off);
  3008. $mat-slider-off-focused-color: mat-color($foreground, slider-off-active);
  3009. $mat-slider-disabled-color: mat-color($foreground, slider-off);
  3010. $mat-slider-labeled-min-value-thumb-color: mat-color($foreground, slider-min);
  3011. $mat-slider-labeled-min-value-thumb-label-color: mat-color($foreground, slider-off);
  3012. $mat-slider-focus-ring-color: mat-color($accent, default, 0.2);
  3013. $mat-slider-focus-ring-min-value-color: mat-color($foreground, base, 0.12);
  3014. $mat-slider-tick-color: mat-color($foreground, base, 0.7);
  3015. $mat-slider-tick-size: 2px;
  3016. .mat-slider-track-background {
  3017. background-color: $mat-slider-off-color;
  3018. }
  3019. .mat-primary {
  3020. @include _mat-slider-inner-content-theme($primary);
  3021. }
  3022. .mat-accent {
  3023. @include _mat-slider-inner-content-theme($accent);
  3024. }
  3025. .mat-warn {
  3026. @include _mat-slider-inner-content-theme($warn);
  3027. }
  3028. .mat-slider-focus-ring {
  3029. background-color: $mat-slider-focus-ring-color;
  3030. }
  3031. .mat-slider:hover,
  3032. .cdk-focused {
  3033. .mat-slider-track-background {
  3034. background-color: $mat-slider-off-focused-color;
  3035. }
  3036. }
  3037. .mat-slider-disabled {
  3038. .mat-slider-track-background,
  3039. .mat-slider-track-fill,
  3040. .mat-slider-thumb {
  3041. background-color: $mat-slider-disabled-color;
  3042. }
  3043. &:hover {
  3044. .mat-slider-track-background {
  3045. background-color: $mat-slider-disabled-color;
  3046. }
  3047. }
  3048. }
  3049. .mat-slider-min-value {
  3050. .mat-slider-focus-ring {
  3051. background-color: $mat-slider-focus-ring-min-value-color;
  3052. }
  3053. &.mat-slider-thumb-label-showing {
  3054. .mat-slider-thumb,
  3055. .mat-slider-thumb-label {
  3056. background-color: $mat-slider-labeled-min-value-thumb-color;
  3057. }
  3058. &.cdk-focused {
  3059. .mat-slider-thumb,
  3060. .mat-slider-thumb-label {
  3061. background-color: $mat-slider-labeled-min-value-thumb-label-color;
  3062. }
  3063. }
  3064. }
  3065. &:not(.mat-slider-thumb-label-showing) {
  3066. .mat-slider-thumb {
  3067. border-color: $mat-slider-off-color;
  3068. background-color: transparent;
  3069. }
  3070. &:hover,
  3071. &.cdk-focused {
  3072. .mat-slider-thumb {
  3073. border-color: $mat-slider-off-focused-color;
  3074. }
  3075. &.mat-slider-disabled .mat-slider-thumb {
  3076. border-color: $mat-slider-disabled-color;
  3077. }
  3078. }
  3079. }
  3080. }
  3081. .mat-slider-has-ticks .mat-slider-wrapper::after {
  3082. border-color: $mat-slider-tick-color;
  3083. }
  3084. .mat-slider-horizontal .mat-slider-ticks {
  3085. background-image: repeating-linear-gradient(to right, $mat-slider-tick-color,
  3086. $mat-slider-tick-color $mat-slider-tick-size, transparent 0, transparent);
  3087. // Firefox doesn't draw the gradient correctly with 'to right'
  3088. // (see https://bugzilla.mozilla.org/show_bug.cgi?id=1314319).
  3089. background-image: -moz-repeating-linear-gradient(0.0001deg, $mat-slider-tick-color,
  3090. $mat-slider-tick-color $mat-slider-tick-size, transparent 0, transparent);
  3091. }
  3092. .mat-slider-vertical .mat-slider-ticks {
  3093. background-image: repeating-linear-gradient(to bottom, $mat-slider-tick-color,
  3094. $mat-slider-tick-color $mat-slider-tick-size, transparent 0, transparent);
  3095. }
  3096. }
  3097. @mixin mat-slider-typography($config) {
  3098. .mat-slider-thumb-label-text {
  3099. font: {
  3100. family: mat-font-family($config);
  3101. size: mat-font-size($config, caption);
  3102. weight: mat-font-weight($config, body-2);
  3103. }
  3104. }
  3105. }
  3106. @mixin mat-stepper-theme($theme) {
  3107. $foreground: map-get($theme, foreground);
  3108. $background: map-get($theme, background);
  3109. $primary: map-get($theme, primary);
  3110. $warn: map-get($theme, warn);
  3111. .mat-step-header {
  3112. &.cdk-keyboard-focused,
  3113. &.cdk-program-focused,
  3114. &:hover {
  3115. background-color: mat-color($background, hover);
  3116. }
  3117. // On touch devices the :hover state will linger on the element after a tap.
  3118. // Reset it via `@media` after the declaration, because the media query isn't
  3119. // supported by all browsers yet.
  3120. @media (hover: none) {
  3121. &:hover {
  3122. background: none;
  3123. }
  3124. }
  3125. .mat-step-label,
  3126. .mat-step-optional {
  3127. // TODO(josephperrott): Update to using a corrected disabled-text contrast
  3128. // instead of secondary-text.
  3129. color: mat-color($foreground, secondary-text);
  3130. }
  3131. .mat-step-icon {
  3132. // TODO(josephperrott): Update to using a corrected disabled-text contrast
  3133. // instead of secondary-text.
  3134. background-color: mat-color($foreground, secondary-text);
  3135. color: mat-color($primary, default-contrast);
  3136. }
  3137. .mat-step-icon-selected,
  3138. .mat-step-icon-state-done,
  3139. .mat-step-icon-state-edit {
  3140. background-color: mat-color($primary);
  3141. color: mat-color($primary, default-contrast);
  3142. }
  3143. .mat-step-icon-state-error {
  3144. background-color: transparent;
  3145. color: mat-color($warn, text);
  3146. }
  3147. .mat-step-label.mat-step-label-active {
  3148. color: mat-color($foreground, text);
  3149. }
  3150. .mat-step-label.mat-step-label-error {
  3151. color: mat-color($warn, text);
  3152. }
  3153. }
  3154. .mat-stepper-horizontal, .mat-stepper-vertical {
  3155. background-color: mat-color($background, card);
  3156. }
  3157. .mat-stepper-vertical-line::before {
  3158. border-left-color: mat-color($foreground, divider);
  3159. }
  3160. .mat-horizontal-stepper-header::before,
  3161. .mat-horizontal-stepper-header::after,
  3162. .mat-stepper-horizontal-line {
  3163. border-top-color: mat-color($foreground, divider);
  3164. }
  3165. }
  3166. @mixin mat-stepper-typography($config) {
  3167. .mat-stepper-vertical, .mat-stepper-horizontal {
  3168. font-family: mat-font-family($config);
  3169. }
  3170. .mat-step-label {
  3171. font: {
  3172. size: mat-font-size($config, body-1);
  3173. weight: mat-font-weight($config, body-1);
  3174. };
  3175. }
  3176. .mat-step-sub-label-error {
  3177. font-weight: normal;
  3178. }
  3179. .mat-step-label-error {
  3180. font-size: mat-font-size($config, body-2);
  3181. }
  3182. .mat-step-label-selected {
  3183. font: {
  3184. size: mat-font-size($config, body-2);
  3185. weight: mat-font-weight($config, body-2);
  3186. };
  3187. }
  3188. }
  3189. @mixin mat-sort-theme($theme) {
  3190. $background: map-get($theme, background);
  3191. $foreground: map-get($theme, foreground);
  3192. .mat-sort-header-arrow {
  3193. $table-background: mat-color($background, 'card');
  3194. $text-color: mat-color($foreground, secondary-text);
  3195. // Because the arrow is made up of multiple elements that are stacked on top of each other,
  3196. // we can't use the semi-trasparent color from the theme directly. If the value is a color
  3197. // *type*, we convert it into a solid color by taking the opacity from the rgba value and
  3198. // using the value to determine the percentage of the background to put into foreground
  3199. // when mixing the colors together. Otherwise, if it resolves to something different
  3200. // (e.g. it resolves to a CSS variable), we use the color directly.
  3201. @if (type-of($table-background) == color and type-of($text-color) == color) {
  3202. $text-opacity: opacity($text-color);
  3203. color: mix($table-background, rgba($text-color, 1), (1 - $text-opacity) * 100%);
  3204. }
  3205. @else {
  3206. color: $text-color;
  3207. }
  3208. }
  3209. }
  3210. @mixin mat-sort-typography($config) { }
  3211. @mixin mat-tabs-theme($theme) {
  3212. $primary: map-get($theme, primary);
  3213. $accent: map-get($theme, accent);
  3214. $warn: map-get($theme, warn);
  3215. $background: map-get($theme, background);
  3216. $foreground: map-get($theme, foreground);
  3217. $header-border: 1px solid mat-color($foreground, divider);
  3218. .mat-tab-nav-bar,
  3219. .mat-tab-header {
  3220. border-bottom: $header-border;
  3221. }
  3222. .mat-tab-group-inverted-header {
  3223. .mat-tab-nav-bar,
  3224. .mat-tab-header {
  3225. border-top: $header-border;
  3226. border-bottom: none;
  3227. }
  3228. }
  3229. .mat-tab-label, .mat-tab-link {
  3230. color: mat-color($foreground, text);
  3231. &.mat-tab-disabled {
  3232. color: mat-color($foreground, disabled-text);
  3233. }
  3234. }
  3235. .mat-tab-header-pagination-chevron {
  3236. border-color: mat-color($foreground, text);
  3237. }
  3238. .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {
  3239. border-color: mat-color($foreground, disabled-text);
  3240. }
  3241. // Remove header border when there is a background color
  3242. .mat-tab-group[class*='mat-background-'] .mat-tab-header,
  3243. .mat-tab-nav-bar[class*='mat-background-'] {
  3244. border-bottom: none;
  3245. border-top: none;
  3246. }
  3247. .mat-tab-group, .mat-tab-nav-bar {
  3248. $theme-colors: (
  3249. primary: $primary,
  3250. accent: $accent,
  3251. warn: $warn
  3252. );
  3253. @each $name, $color in $theme-colors {
  3254. // Set the foreground color of the tabs
  3255. &.mat-#{$name} {
  3256. @include _mat-tab-label-focus($color);
  3257. @include _mat-ink-bar($color);
  3258. // Override ink bar when background color is the same
  3259. &.mat-background-#{$name} {
  3260. @include _mat-ink-bar($color, default-contrast);
  3261. }
  3262. }
  3263. }
  3264. @each $name, $color in $theme-colors {
  3265. // Set background color of the tabs and override focus color
  3266. &.mat-background-#{$name} {
  3267. @include _mat-tab-label-focus($color);
  3268. @include _mat-tabs-background($color);
  3269. }
  3270. }
  3271. }
  3272. }
  3273. @mixin _mat-ink-bar($color, $hue: default) {
  3274. .mat-ink-bar {
  3275. background-color: mat-color($color, $hue);
  3276. }
  3277. }
  3278. @mixin _mat-tab-label-focus($tab-focus-color) {
  3279. .mat-tab-label,
  3280. .mat-tab-link {
  3281. &.cdk-keyboard-focused,
  3282. &.cdk-program-focused {
  3283. &:not(.mat-tab-disabled) {
  3284. background-color: mat-color($tab-focus-color, lighter, 0.3);
  3285. }
  3286. }
  3287. }
  3288. }
  3289. @mixin _mat-tabs-background($background-color) {
  3290. // Set background color for the tab group
  3291. .mat-tab-header, .mat-tab-links, .mat-tab-header-pagination {
  3292. background-color: mat-color($background-color);
  3293. }
  3294. // Set labels to contrast against background
  3295. .mat-tab-label, .mat-tab-link {
  3296. color: mat-color($background-color, default-contrast);
  3297. &.mat-tab-disabled {
  3298. color: mat-color($background-color, default-contrast, 0.4);
  3299. }
  3300. }
  3301. // Set pagination chevrons to contrast background
  3302. .mat-tab-header-pagination-chevron {
  3303. border-color: mat-color($background-color, default-contrast);
  3304. }
  3305. .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {
  3306. border-color: mat-color($background-color, default-contrast, 0.4);
  3307. }
  3308. // Set ripples color to be the contrast color of the new background. Otherwise the ripple
  3309. // color will be based on the app background color.
  3310. .mat-ripple-element {
  3311. background-color: mat-color($background-color, default-contrast, 0.12);
  3312. }
  3313. }
  3314. @mixin mat-tabs-typography($config) {
  3315. .mat-tab-group {
  3316. font-family: mat-font-family($config);
  3317. }
  3318. .mat-tab-label, .mat-tab-link {
  3319. font: {
  3320. family: mat-font-family($config, button);
  3321. size: mat-font-size($config, button);
  3322. weight: mat-font-weight($config, button);
  3323. }
  3324. }
  3325. }
  3326. @mixin _mat-toolbar-color($palette) {
  3327. background: mat-color($palette);
  3328. color: mat-color($palette, default-contrast);
  3329. }
  3330. @mixin _mat-toolbar-form-field-overrides {
  3331. .mat-form-field-underline,
  3332. .mat-form-field-ripple,
  3333. .mat-focused .mat-form-field-ripple {
  3334. background-color: currentColor;
  3335. }
  3336. .mat-form-field-label,
  3337. .mat-focused .mat-form-field-label,
  3338. .mat-select-value,
  3339. .mat-select-arrow,
  3340. .mat-form-field.mat-focused .mat-select-arrow {
  3341. color: inherit;
  3342. }
  3343. .mat-input-element {
  3344. caret-color: currentColor;
  3345. }
  3346. }
  3347. @mixin mat-toolbar-theme($theme) {
  3348. $primary: map-get($theme, primary);
  3349. $accent: map-get($theme, accent);
  3350. $warn: map-get($theme, warn);
  3351. $background: map-get($theme, background);
  3352. $foreground: map-get($theme, foreground);
  3353. .mat-toolbar {
  3354. background: mat-color($background, app-bar);
  3355. color: mat-color($foreground, text);
  3356. &.mat-primary {
  3357. @include _mat-toolbar-color($primary);
  3358. }
  3359. &.mat-accent {
  3360. @include _mat-toolbar-color($accent);
  3361. }
  3362. &.mat-warn {
  3363. @include _mat-toolbar-color($warn);
  3364. }
  3365. @include _mat-toolbar-form-field-overrides;
  3366. }
  3367. }
  3368. @mixin mat-toolbar-typography($config) {
  3369. .mat-toolbar,
  3370. .mat-toolbar h1,
  3371. .mat-toolbar h2,
  3372. .mat-toolbar h3,
  3373. .mat-toolbar h4,
  3374. .mat-toolbar h5,
  3375. .mat-toolbar h6 {
  3376. @include mat-typography-level-to-styles($config, title);
  3377. margin: 0;
  3378. }
  3379. }
  3380. $mat-tooltip-target-height: 22px;
  3381. $mat-tooltip-font-size: 10px;
  3382. $mat-tooltip-vertical-padding: ($mat-tooltip-target-height - $mat-tooltip-font-size) / 2;
  3383. $mat-tooltip-handset-target-height: 30px;
  3384. $mat-tooltip-handset-font-size: 14px;
  3385. $mat-tooltip-handset-vertical-padding:
  3386. ($mat-tooltip-handset-target-height - $mat-tooltip-handset-font-size) / 2;
  3387. @mixin mat-tooltip-theme($theme) {
  3388. .mat-tooltip {
  3389. background: mat-color($mat-grey, 700, 0.9);
  3390. }
  3391. }
  3392. @mixin mat-tooltip-typography($config) {
  3393. .mat-tooltip {
  3394. font-family: mat-font-family($config);
  3395. font-size: $mat-tooltip-font-size;
  3396. padding-top: $mat-tooltip-vertical-padding;
  3397. padding-bottom: $mat-tooltip-vertical-padding;
  3398. }
  3399. .mat-tooltip-handset {
  3400. font-size: $mat-tooltip-handset-font-size;
  3401. padding-top: $mat-tooltip-handset-vertical-padding;
  3402. padding-bottom: $mat-tooltip-handset-vertical-padding;
  3403. }
  3404. }
  3405. @mixin mat-snack-bar-theme($theme) {
  3406. $is-dark-theme: map-get($theme, is-dark);
  3407. $accent: map-get($theme, accent);
  3408. .mat-snack-bar-container {
  3409. // Use the primary text on the dark theme, even though the lighter one uses
  3410. // a secondary, because the contrast on the light primary text is poor.
  3411. color: if($is-dark-theme, $dark-primary-text, $light-secondary-text);
  3412. background: if($is-dark-theme, map-get($mat-grey, 50), #323232);
  3413. @include _mat-theme-elevation(6, $theme);
  3414. }
  3415. .mat-simple-snackbar-action {
  3416. color: if($is-dark-theme, inherit, mat-color($accent, text));
  3417. }
  3418. }
  3419. @mixin mat-snack-bar-typography($config) {
  3420. .mat-simple-snackbar {
  3421. font: {
  3422. family: mat-font-family($config, body-1);
  3423. size: mat-font-size($config, body-1);
  3424. }
  3425. }
  3426. .mat-simple-snackbar-action {
  3427. line-height: 1;
  3428. font: {
  3429. family: inherit;
  3430. size: inherit;
  3431. weight: mat-font-weight($config, button);
  3432. }
  3433. }
  3434. }
  3435. // Theme styles that only apply to the fill appearance of the form-field.
  3436. @mixin mat-form-field-fill-theme($theme) {
  3437. $foreground: map-get($theme, foreground);
  3438. $is-dark-theme: map-get($theme, is-dark);
  3439. $fill-background: mat-color($foreground, base, if($is-dark-theme, 0.1, 0.04));
  3440. $fill-disabled-background: mat-color($foreground, base, if($is-dark-theme, 0.05, 0.02));
  3441. $underline-color: mat-color($foreground, divider, if($is-dark-theme, 0.5, 0.42));
  3442. $label-disabled-color: mat-color($foreground, disabled-text);
  3443. .mat-form-field-appearance-fill {
  3444. .mat-form-field-flex {
  3445. background-color: $fill-background;
  3446. }
  3447. &.mat-form-field-disabled .mat-form-field-flex {
  3448. background-color: $fill-disabled-background;
  3449. }
  3450. .mat-form-field-underline::before {
  3451. background-color: $underline-color;
  3452. }
  3453. &.mat-form-field-disabled {
  3454. .mat-form-field-label {
  3455. color: $label-disabled-color;
  3456. }
  3457. .mat-form-field-underline::before {
  3458. background-color: transparent;
  3459. }
  3460. }
  3461. }
  3462. }
  3463. // Used to make instances of the _mat-form-field-label-floating mixin negligibly different,
  3464. // and prevent Google's CSS Optimizer from collapsing the declarations. This is needed because some
  3465. // of the selectors contain pseudo-classes not recognized in all browsers. If a browser encounters
  3466. // an unknown pseudo-class it will discard the entire rule set.
  3467. $mat-form-field-fill-dedupe: 0;
  3468. // Applies a floating label above the form field control itself.
  3469. @mixin _mat-form-field-fill-label-floating($font-scale, $infix-padding, $infix-margin-top) {
  3470. transform: translateY(-$infix-margin-top - $infix-padding + $mat-form-field-fill-dedupe)
  3471. scale($font-scale);
  3472. width: 100% / $font-scale + $mat-form-field-fill-dedupe;
  3473. $mat-form-field-fill-dedupe: $mat-form-field-fill-dedupe + 0.00001 !global;
  3474. }
  3475. @mixin mat-form-field-fill-typography($config) {
  3476. // The unit-less line-height from the font config.
  3477. $line-height: mat-line-height($config, input);
  3478. // The amount to scale the font for the floating label and subscript.
  3479. $subscript-font-scale: 0.75;
  3480. // The padding on top of the infix.
  3481. $infix-padding-top: 0.25em;
  3482. // The padding below the infix.
  3483. $infix-padding-bottom: 0.75em;
  3484. // The margin applied to the form-field-infix to reserve space for the floating label.
  3485. $infix-margin-top: 1em * $line-height * $subscript-font-scale;
  3486. // The amount we offset the label from the input text in the fill appearance.
  3487. $fill-appearance-label-offset: -0.5em;
  3488. .mat-form-field-appearance-fill {
  3489. .mat-form-field-infix {
  3490. padding: $infix-padding-top 0 $infix-padding-bottom 0;
  3491. }
  3492. .mat-form-field-label {
  3493. top: $infix-margin-top + $infix-padding-top;
  3494. margin-top: $fill-appearance-label-offset;
  3495. }
  3496. &.mat-form-field-can-float {
  3497. &.mat-form-field-should-float .mat-form-field-label,
  3498. .mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label {
  3499. @include _mat-form-field-fill-label-floating(
  3500. $subscript-font-scale, $infix-padding-top + $fill-appearance-label-offset,
  3501. $infix-margin-top);
  3502. }
  3503. // Server-side rendered matInput with a label attribute but label not shown
  3504. // (used as a pure CSS stand-in for mat-form-field-should-float).
  3505. .mat-input-server[label]:not(:label-shown) + .mat-form-field-label-wrapper
  3506. .mat-form-field-label {
  3507. @include _mat-form-field-fill-label-floating(
  3508. $subscript-font-scale, $infix-padding-top + $fill-appearance-label-offset,
  3509. $infix-margin-top);
  3510. }
  3511. }
  3512. }
  3513. }
  3514. // Theme styles that only apply to the legacy appearance of the form-field.
  3515. @mixin mat-form-field-legacy-theme($theme) {
  3516. $foreground: map-get($theme, foreground);
  3517. $is-dark-theme: map-get($theme, is-dark);
  3518. $label-color: mat-color($foreground, secondary-text);
  3519. $underline-color: mat-color($foreground, divider, if($is-dark-theme, 0.7, 0.42));
  3520. .mat-form-field-appearance-legacy {
  3521. .mat-form-field-label {
  3522. color: $label-color;
  3523. }
  3524. .mat-hint {
  3525. color: $label-color;
  3526. }
  3527. .mat-form-field-underline {
  3528. background-color: $underline-color;
  3529. }
  3530. &.mat-form-field-disabled .mat-form-field-underline {
  3531. @include mat-control-disabled-underline($underline-color);
  3532. }
  3533. }
  3534. }
  3535. // Used to make instances of the _mat-form-field-label-floating mixin negligibly different,
  3536. // and prevent Google's CSS Optimizer from collapsing the declarations. This is needed because some
  3537. // of the selectors contain pseudo-classes not recognized in all browsers. If a browser encounters
  3538. // an unknown pseudo-class it will discard the entire rule set.
  3539. $mat-form-field-legacy-dedupe: 0;
  3540. // Applies a floating label above the form field control itself.
  3541. @mixin _mat-form-field-legacy-label-floating($font-scale, $infix-padding, $infix-margin-top) {
  3542. // We use perspective to fix the text blurriness as described here:
  3543. // http://www.useragentman.com/blog/2014/05/04/fixing-typography-inside-of-2-d-css-transforms/
  3544. // This results in a small jitter after the label floats on Firefox, which the
  3545. // translateZ fixes.
  3546. transform: translateY(-$infix-margin-top - $infix-padding) scale($font-scale) perspective(100px)
  3547. translateZ(0.001px + $mat-form-field-legacy-dedupe);
  3548. // The tricks above used to smooth out the animation on chrome and firefox actually make things
  3549. // worse on IE, so we don't include them in the IE version.
  3550. -ms-transform: translateY(-$infix-margin-top - $infix-padding + $mat-form-field-legacy-dedupe)
  3551. scale($font-scale);
  3552. width: 100% / $font-scale + $mat-form-field-legacy-dedupe;
  3553. $mat-form-field-legacy-dedupe: $mat-form-field-legacy-dedupe + 0.00001 !global;
  3554. }
  3555. // Same as mixin above, but omits the translateZ for printing purposes.
  3556. @mixin _mat-form-field-legacy-label-floating-print($font-scale, $infix-padding, $infix-margin-top) {
  3557. // This results in a small jitter after the label floats on Firefox, which the
  3558. // translateZ fixes.
  3559. transform: translateY(-$infix-margin-top - $infix-padding + $mat-form-field-legacy-dedupe)
  3560. scale($font-scale);
  3561. // The tricks above used to smooth out the animation on chrome and firefox actually make things
  3562. // worse on IE, so we don't include them in the IE version.
  3563. $mat-form-field-legacy-dedupe: $mat-form-field-legacy-dedupe + 0.00001 !global;
  3564. }
  3565. @mixin mat-form-field-legacy-typography($config) {
  3566. // The unit-less line-height from the font config.
  3567. $line-height: mat-line-height($config, input);
  3568. // The amount to scale the font for the floating label and subscript.
  3569. $subscript-font-scale: 0.75;
  3570. // The amount of space between the top of the line and the top of the actual text
  3571. // (as a fraction of the font-size).
  3572. $line-spacing: ($line-height - 1) / 2;
  3573. // The padding on the infix. Mocks show half of the text size, but seem to measure from the edge
  3574. // of the text itself, not the edge of the line; therefore we subtract off the line spacing.
  3575. $infix-padding: 0.5em - $line-spacing;
  3576. // The margin applied to the form-field-infix to reserve space for the floating label.
  3577. $infix-margin-top: 1em * $line-height * $subscript-font-scale;
  3578. // The space between the bottom of the .mat-form-field-flex area and the subscript wrapper.
  3579. // Mocks show half of the text size, but this margin is applied to an element with the subscript
  3580. // text font size, so we need to divide by the scale factor to make it half of the original text
  3581. // size. We again need to subtract off the line spacing since the mocks measure to the edge of the
  3582. // text, not the edge of the line.
  3583. $subscript-margin-top: 0.5em / $subscript-font-scale - ($line-spacing * 2);
  3584. // The padding applied to the form-field-wrapper to reserve space for the subscript, since it's
  3585. // absolutely positioned. This is a combination of the subscript's margin and line-height, but we
  3586. // need to multiply by the subscript font scale factor since the wrapper has a larger font size.
  3587. $wrapper-padding-bottom: ($subscript-margin-top + $line-height) * $subscript-font-scale;
  3588. .mat-form-field-appearance-legacy {
  3589. .mat-form-field-wrapper {
  3590. padding-bottom: $wrapper-padding-bottom;
  3591. }
  3592. .mat-form-field-infix {
  3593. padding: $infix-padding 0;
  3594. }
  3595. &.mat-form-field-can-float {
  3596. &.mat-form-field-should-float .mat-form-field-label,
  3597. .mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label {
  3598. @include _mat-form-field-legacy-label-floating(
  3599. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3600. }
  3601. // @breaking-change 8.0.0 will rely on AutofillMonitor instead.
  3602. .mat-form-field-autofill-control:-webkit-autofill + .mat-form-field-label-wrapper
  3603. .mat-form-field-label {
  3604. @include _mat-form-field-legacy-label-floating(
  3605. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3606. }
  3607. // Server-side rendered matInput with a label attribute but label not shown
  3608. // (used as a pure CSS stand-in for mat-form-field-should-float).
  3609. .mat-input-server[label]:not(:label-shown) + .mat-form-field-label-wrapper
  3610. .mat-form-field-label {
  3611. @include _mat-form-field-legacy-label-floating(
  3612. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3613. }
  3614. }
  3615. .mat-form-field-label {
  3616. top: $infix-margin-top + $infix-padding;
  3617. }
  3618. .mat-form-field-underline {
  3619. // We want the underline to start at the end of the content box, not the padding box,
  3620. // so we move it up by the padding amount.
  3621. bottom: $wrapper-padding-bottom;
  3622. }
  3623. .mat-form-field-subscript-wrapper {
  3624. margin-top: $subscript-margin-top;
  3625. // We want the subscript to start at the end of the content box, not the padding box,
  3626. // so we move it up by the padding amount (adjusted for the smaller font size);
  3627. top: calc(100% - #{$wrapper-padding-bottom / $subscript-font-scale});
  3628. }
  3629. }
  3630. // translateZ causes the label to not appear while printing, so we override it to not
  3631. // apply translateZ while printing
  3632. @media print {
  3633. .mat-form-field-appearance-legacy {
  3634. &.mat-form-field-can-float {
  3635. &.mat-form-field-should-float .mat-form-field-label,
  3636. .mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label {
  3637. @include _mat-form-field-legacy-label-floating-print(
  3638. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3639. }
  3640. // @breaking-change 8.0.0 will rely on AutofillMonitor instead.
  3641. .mat-form-field-autofill-control:-webkit-autofill + .mat-form-field-label-wrapper
  3642. .mat-form-field-label {
  3643. @include _mat-form-field-legacy-label-floating-print(
  3644. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3645. }
  3646. // Server-side rendered matInput with a label attribute but label not shown
  3647. // (used as a pure CSS stand-in for mat-form-field-should-float).
  3648. .mat-input-server[label]:not(:label-shown) + .mat-form-field-label-wrapper
  3649. .mat-form-field-label {
  3650. @include _mat-form-field-legacy-label-floating-print(
  3651. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3652. }
  3653. }
  3654. }
  3655. }
  3656. }
  3657. // Theme styles that only apply to the outline appearance of the form-field.
  3658. @mixin mat-form-field-outline-theme($theme) {
  3659. $primary: map-get($theme, primary);
  3660. $accent: map-get($theme, accent);
  3661. $warn: map-get($theme, warn);
  3662. $foreground: map-get($theme, foreground);
  3663. $is-dark-theme: map-get($theme, is-dark);
  3664. $label-disabled-color: mat-color($foreground, disabled-text);
  3665. $outline-color: mat-color($foreground, divider, if($is-dark-theme, 0.3, 0.12));
  3666. $outline-color-hover: mat-color($foreground, divider, if($is-dark-theme, 1, 0.87));
  3667. $outline-color-primary: mat-color($primary);
  3668. $outline-color-accent: mat-color($accent);
  3669. $outline-color-warn: mat-color($warn);
  3670. $outline-color-disabled: mat-color($foreground, divider, if($is-dark-theme, 0.15, 0.06));
  3671. .mat-form-field-appearance-outline {
  3672. .mat-form-field-outline {
  3673. color: $outline-color;
  3674. }
  3675. .mat-form-field-outline-thick {
  3676. color: $outline-color-hover;
  3677. }
  3678. &.mat-focused {
  3679. .mat-form-field-outline-thick {
  3680. color: $outline-color-primary;
  3681. }
  3682. &.mat-accent .mat-form-field-outline-thick {
  3683. color: $outline-color-accent;
  3684. }
  3685. &.mat-warn .mat-form-field-outline-thick {
  3686. color: $outline-color-warn;
  3687. }
  3688. }
  3689. // Class repeated so that rule is specific enough to override focused accent color case.
  3690. &.mat-form-field-invalid.mat-form-field-invalid {
  3691. .mat-form-field-outline-thick {
  3692. color: $outline-color-warn;
  3693. }
  3694. }
  3695. &.mat-form-field-disabled {
  3696. .mat-form-field-label {
  3697. color: $label-disabled-color;
  3698. }
  3699. .mat-form-field-outline {
  3700. color: $outline-color-disabled;
  3701. }
  3702. }
  3703. }
  3704. }
  3705. // Used to make instances of the _mat-form-field-label-floating mixin negligibly different,
  3706. // and prevent Google's CSS Optimizer from collapsing the declarations. This is needed because some
  3707. // of the selectors contain pseudo-classes not recognized in all browsers. If a browser encounters
  3708. // an unknown pseudo-class it will discard the entire rule set.
  3709. $mat-form-field-outline-dedupe: 0;
  3710. // Applies a floating label above the form field control itself.
  3711. @mixin _mat-form-field-outline-label-floating($font-scale, $infix-padding, $infix-margin-top) {
  3712. transform: translateY(-$infix-margin-top - $infix-padding + $mat-form-field-outline-dedupe)
  3713. scale($font-scale);
  3714. width: 100% / $font-scale + $mat-form-field-outline-dedupe;
  3715. $mat-form-field-outline-dedupe: $mat-form-field-outline-dedupe + 0.00001 !global;
  3716. }
  3717. @mixin mat-form-field-outline-typography($config) {
  3718. // The unit-less line-height from the font config.
  3719. $line-height: mat-line-height($config, input);
  3720. // The amount to scale the font for the floating label and subscript.
  3721. $subscript-font-scale: 0.75;
  3722. // The padding above and below the infix.
  3723. $infix-padding: 1em;
  3724. // The margin applied to the form-field-infix to reserve space for the floating label.
  3725. $infix-margin-top: 1em * $line-height * $subscript-font-scale;
  3726. // The space between the bottom of the .mat-form-field-flex area and the subscript wrapper.
  3727. // Mocks show half of the text size, but this margin is applied to an element with the subscript
  3728. // text font size, so we need to divide by the scale factor to make it half of the original text
  3729. // size.
  3730. $subscript-margin-top: 0.5em / $subscript-font-scale;
  3731. // The padding applied to the form-field-wrapper to reserve space for the subscript, since it's
  3732. // absolutely positioned. This is a combination of the subscript's margin and line-height, but we
  3733. // need to multiply by the subscript font scale factor since the wrapper has a larger font size.
  3734. $wrapper-padding-bottom: ($subscript-margin-top + $line-height) * $subscript-font-scale;
  3735. // The amount we offset the label from the input text in the outline appearance.
  3736. $outline-appearance-label-offset: -0.25em;
  3737. .mat-form-field-appearance-outline {
  3738. .mat-form-field-infix {
  3739. padding: $infix-padding 0 $infix-padding 0;
  3740. }
  3741. .mat-form-field-label {
  3742. top: $infix-margin-top + $infix-padding;
  3743. margin-top: $outline-appearance-label-offset;
  3744. }
  3745. &.mat-form-field-can-float {
  3746. &.mat-form-field-should-float .mat-form-field-label,
  3747. .mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label {
  3748. @include _mat-form-field-outline-label-floating(
  3749. $subscript-font-scale, $infix-padding + $outline-appearance-label-offset,
  3750. $infix-margin-top);
  3751. }
  3752. // Server-side rendered matInput with a label attribute but label not shown
  3753. // (used as a pure CSS stand-in for mat-form-field-should-float).
  3754. .mat-input-server[label]:not(:label-shown) + .mat-form-field-label-wrapper
  3755. .mat-form-field-label {
  3756. @include _mat-form-field-outline-label-floating(
  3757. $subscript-font-scale, $infix-padding + $outline-appearance-label-offset,
  3758. $infix-margin-top);
  3759. }
  3760. }
  3761. }
  3762. }
  3763. // Theme styles that only apply to the standard appearance of the form-field.
  3764. @mixin mat-form-field-standard-theme($theme) {
  3765. $foreground: map-get($theme, foreground);
  3766. $is-dark-theme: map-get($theme, is-dark);
  3767. $underline-color: mat-color($foreground, divider, if($is-dark-theme, 0.7, 0.42));
  3768. .mat-form-field-appearance-standard {
  3769. .mat-form-field-underline {
  3770. background-color: $underline-color;
  3771. }
  3772. &.mat-form-field-disabled .mat-form-field-underline {
  3773. @include mat-control-disabled-underline($underline-color);
  3774. }
  3775. }
  3776. }
  3777. @mixin mat-form-field-standard-typography($config) {}
  3778. // Theme styles that apply to all appearances of the form-field.
  3779. @mixin mat-form-field-theme($theme) {
  3780. $primary: map-get($theme, primary);
  3781. $accent: map-get($theme, accent);
  3782. $warn: map-get($theme, warn);
  3783. $background: map-get($theme, background);
  3784. $foreground: map-get($theme, foreground);
  3785. $is-dark-theme: map-get($theme, is-dark);
  3786. // Label colors. Required is used for the `*` star shown in the label.
  3787. $label-color: mat-color($foreground, secondary-text, if($is-dark-theme, 0.7, 0.6));
  3788. $focused-label-color: mat-color($primary, text);
  3789. $required-label-color: mat-color($accent, text);
  3790. // Underline colors.
  3791. $underline-color-base: mat-color($foreground, divider, if($is-dark-theme, 1, 0.87));
  3792. $underline-color-accent: mat-color($accent, text);
  3793. $underline-color-warn: mat-color($warn, text);
  3794. $underline-focused-color: mat-color($primary, text);
  3795. .mat-form-field-label {
  3796. color: $label-color;
  3797. }
  3798. .mat-hint {
  3799. color: $label-color;
  3800. }
  3801. .mat-form-field.mat-focused .mat-form-field-label {
  3802. color: $focused-label-color;
  3803. &.mat-accent {
  3804. color: $underline-color-accent;
  3805. }
  3806. &.mat-warn {
  3807. color: $underline-color-warn;
  3808. }
  3809. }
  3810. .mat-focused .mat-form-field-required-marker {
  3811. color: $required-label-color;
  3812. }
  3813. .mat-form-field-ripple {
  3814. background-color: $underline-color-base;
  3815. }
  3816. .mat-form-field.mat-focused {
  3817. .mat-form-field-ripple {
  3818. background-color: $underline-focused-color;
  3819. &.mat-accent {
  3820. background-color: $underline-color-accent;
  3821. }
  3822. &.mat-warn {
  3823. background-color: $underline-color-warn;
  3824. }
  3825. }
  3826. }
  3827. .mat-form-field-type-mat-native-select.mat-focused:not(.mat-form-field-invalid) {
  3828. .mat-form-field-infix::after {
  3829. color: $underline-focused-color;
  3830. }
  3831. &.mat-accent .mat-form-field-infix::after {
  3832. color: $underline-color-accent;
  3833. }
  3834. &.mat-warn .mat-form-field-infix::after {
  3835. color: $underline-color-warn;
  3836. }
  3837. }
  3838. // Styling for the error state of the form field. Note that while the same can be
  3839. // achieved with the ng-* classes, we use this approach in order to ensure that the same
  3840. // logic is used to style the error state and to show the error messages.
  3841. .mat-form-field.mat-form-field-invalid {
  3842. .mat-form-field-label {
  3843. color: $underline-color-warn;
  3844. &.mat-accent,
  3845. .mat-form-field-required-marker {
  3846. color: $underline-color-warn;
  3847. }
  3848. }
  3849. .mat-form-field-ripple,
  3850. .mat-form-field-ripple.mat-accent {
  3851. background-color: $underline-color-warn;
  3852. }
  3853. }
  3854. .mat-error {
  3855. color: $underline-color-warn;
  3856. }
  3857. @include mat-form-field-legacy-theme($theme);
  3858. @include mat-form-field-standard-theme($theme);
  3859. @include mat-form-field-fill-theme($theme);
  3860. @include mat-form-field-outline-theme($theme);
  3861. }
  3862. // Used to make instances of the _mat-form-field-label-floating mixin negligibly different,
  3863. // and prevent Google's CSS Optimizer from collapsing the declarations. This is needed because some
  3864. // of the selectors contain pseudo-classes not recognized in all browsers. If a browser encounters
  3865. // an unknown pseudo-class it will discard the entire rule set.
  3866. $mat-form-field-dedupe: 0;
  3867. // Applies a floating label above the form field control itself.
  3868. @mixin _mat-form-field-label-floating($font-scale, $infix-padding, $infix-margin-top) {
  3869. transform: translateY(-$infix-margin-top - $infix-padding + $mat-form-field-dedupe)
  3870. scale($font-scale);
  3871. width: 100% / $font-scale + $mat-form-field-dedupe;
  3872. $mat-form-field-dedupe: $mat-form-field-dedupe + 0.00001 !global;
  3873. }
  3874. @mixin mat-form-field-typography($config) {
  3875. // The unit-less line-height from the font config.
  3876. $line-height: mat-line-height($config, input);
  3877. // The amount to scale the font for the floating label and subscript.
  3878. $subscript-font-scale: 0.75;
  3879. // The amount to scale the font for the prefix and suffix icons.
  3880. $prefix-suffix-icon-font-scale: 1.5;
  3881. // The padding on the infix. Mocks show half of the text size.
  3882. $infix-padding: 0.5em;
  3883. // The margin applied to the form-field-infix to reserve space for the floating label.
  3884. $infix-margin-top: 1em * $line-height * $subscript-font-scale;
  3885. // Font size to use for the label and subscript text.
  3886. $subscript-font-size: $subscript-font-scale * 100%;
  3887. // Font size to use for the for the prefix and suffix icons.
  3888. $prefix-suffix-icon-font-size: $prefix-suffix-icon-font-scale * 100%;
  3889. // The space between the bottom of the .mat-form-field-flex area and the subscript wrapper.
  3890. // Mocks show half of the text size, but this margin is applied to an element with the subscript
  3891. // text font size, so we need to divide by the scale factor to make it half of the original text
  3892. // size.
  3893. $subscript-margin-top: 0.5em / $subscript-font-scale;
  3894. // The padding applied to the form-field-wrapper to reserve space for the subscript, since it's
  3895. // absolutely positioned. This is a combination of the subscript's margin and line-height, but we
  3896. // need to multiply by the subscript font scale factor since the wrapper has a larger font size.
  3897. $wrapper-padding-bottom: ($subscript-margin-top + $line-height) * $subscript-font-scale;
  3898. .mat-form-field {
  3899. @include mat-typography-level-to-styles($config, input);
  3900. }
  3901. .mat-form-field-wrapper {
  3902. padding-bottom: $wrapper-padding-bottom;
  3903. }
  3904. .mat-form-field-prefix,
  3905. .mat-form-field-suffix {
  3906. // Allow icons in a prefix or suffix to adapt to the correct size.
  3907. .mat-icon {
  3908. font-size: $prefix-suffix-icon-font-size;
  3909. line-height: $line-height;
  3910. }
  3911. // Allow icon buttons in a prefix or suffix to adapt to the correct size.
  3912. .mat-icon-button {
  3913. height: $prefix-suffix-icon-font-scale * 1em;
  3914. width: $prefix-suffix-icon-font-scale * 1em;
  3915. .mat-icon {
  3916. height: $line-height * 1em;
  3917. line-height: $line-height;
  3918. }
  3919. }
  3920. }
  3921. .mat-form-field-infix {
  3922. padding: $infix-padding 0;
  3923. // Throws off the baseline if we do it as a real margin, so we do it as a border instead.
  3924. border-top: $infix-margin-top solid transparent;
  3925. }
  3926. .mat-form-field-can-float {
  3927. &.mat-form-field-should-float .mat-form-field-label,
  3928. .mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label {
  3929. @include _mat-form-field-label-floating(
  3930. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3931. }
  3932. // Server-side rendered matInput with a label attribute but label not shown
  3933. // (used as a pure CSS stand-in for mat-form-field-should-float).
  3934. .mat-input-server[label]:not(:label-shown) + .mat-form-field-label-wrapper
  3935. .mat-form-field-label {
  3936. @include _mat-form-field-label-floating(
  3937. $subscript-font-scale, $infix-padding, $infix-margin-top);
  3938. }
  3939. }
  3940. .mat-form-field-label-wrapper {
  3941. top: -$infix-margin-top;
  3942. padding-top: $infix-margin-top;
  3943. }
  3944. .mat-form-field-label {
  3945. top: $infix-margin-top + $infix-padding;
  3946. }
  3947. .mat-form-field-underline {
  3948. // We want the underline to start at the end of the content box, not the padding box,
  3949. // so we move it up by the padding amount.
  3950. bottom: $wrapper-padding-bottom;
  3951. }
  3952. .mat-form-field-subscript-wrapper {
  3953. font-size: $subscript-font-size;
  3954. margin-top: $subscript-margin-top;
  3955. // We want the subscript to start at the end of the content box, not the padding box,
  3956. // so we move it up by the padding amount (adjusted for the smaller font size);
  3957. top: calc(100% - #{$wrapper-padding-bottom / $subscript-font-scale});
  3958. }
  3959. @include mat-form-field-legacy-typography($config);
  3960. @include mat-form-field-standard-typography($config);
  3961. @include mat-form-field-fill-typography($config);
  3962. @include mat-form-field-outline-typography($config);
  3963. }
  3964. @mixin mat-tree-theme($theme) {
  3965. $background: map-get($theme, background);
  3966. $foreground: map-get($theme, foreground);
  3967. .mat-tree {
  3968. background: mat-color($background, 'card');
  3969. }
  3970. .mat-tree-node,
  3971. .mat-nested-tree-node {
  3972. color: mat-color($foreground, text);
  3973. }
  3974. }
  3975. @mixin mat-tree-typography($config) {
  3976. .mat-tree {
  3977. font-family: mat-font-family($config);
  3978. }
  3979. .mat-tree-node,
  3980. .mat-nested-tree-node {
  3981. font-weight: mat-font-weight($config, body-1);
  3982. font-size: mat-font-size($config, body-1);
  3983. }
  3984. }
  3985. // Includes all of the typographic styles.
  3986. @mixin angular-material-typography($config: null) {
  3987. @if $config == null {
  3988. $config: mat-typography-config();
  3989. }
  3990. @include mat-badge-typography($config);
  3991. @include mat-base-typography($config);
  3992. @include mat-autocomplete-typography($config);
  3993. @include mat-bottom-sheet-typography($config);
  3994. @include mat-button-typography($config);
  3995. @include mat-button-toggle-typography($config);
  3996. @include mat-card-typography($config);
  3997. @include mat-checkbox-typography($config);
  3998. @include mat-chips-typography($config);
  3999. @include mat-table-typography($config);
  4000. @include mat-datepicker-typography($config);
  4001. @include mat-dialog-typography($config);
  4002. @include mat-expansion-panel-typography($config);
  4003. @include mat-form-field-typography($config);
  4004. @include mat-grid-list-typography($config);
  4005. @include mat-icon-typography($config);
  4006. @include mat-input-typography($config);
  4007. @include mat-menu-typography($config);
  4008. @include mat-paginator-typography($config);
  4009. @include mat-progress-bar-typography($config);
  4010. @include mat-progress-spinner-typography($config);
  4011. @include mat-radio-typography($config);
  4012. @include mat-select-typography($config);
  4013. @include mat-sidenav-typography($config);
  4014. @include mat-slide-toggle-typography($config);
  4015. @include mat-slider-typography($config);
  4016. @include mat-stepper-typography($config);
  4017. @include mat-sort-typography($config);
  4018. @include mat-tabs-typography($config);
  4019. @include mat-toolbar-typography($config);
  4020. @include mat-tooltip-typography($config);
  4021. @include mat-list-typography($config);
  4022. @include mat-option-typography($config);
  4023. @include mat-optgroup-typography($config);
  4024. @include mat-snack-bar-typography($config);
  4025. @include mat-tree-typography($config);
  4026. }
  4027. // Mixin that renders all of the core styles that are not theme-dependent.
  4028. @mixin mat-core($typography-config: null) {
  4029. @include angular-material-typography($typography-config);
  4030. @include mat-ripple();
  4031. @include cdk-a11y();
  4032. @include cdk-overlay();
  4033. @include cdk-text-field();
  4034. }
  4035. // Mixin that renders all of the core styles that depend on the theme.
  4036. @mixin mat-core-theme($theme) {
  4037. @include mat-ripple-theme($theme);
  4038. @include mat-option-theme($theme);
  4039. @include mat-optgroup-theme($theme);
  4040. @include mat-pseudo-checkbox-theme($theme);
  4041. // Provides external CSS classes for each elevation value. Each CSS class is formatted as
  4042. // `mat-elevation-z$zValue` where `$zValue` corresponds to the z-space to which the element is
  4043. // elevated.
  4044. @for $zValue from 0 through 24 {
  4045. .#{$_mat-elevation-prefix}#{$zValue} {
  4046. @include _mat-theme-elevation($zValue, $theme);
  4047. }
  4048. }
  4049. // Wrapper element that provides the theme background when the user's content isn't
  4050. // inside of a `mat-sidenav-container`. Note that we need to exclude the ampersand
  4051. // selector in case the mixin is included at the top level.
  4052. .mat-app-background#{if(&, ', &.mat-app-background', '')} {
  4053. $background: map-get($theme, background);
  4054. $foreground: map-get($theme, foreground);
  4055. background-color: mat-color($background, background);
  4056. color: mat-color($foreground, text);
  4057. }
  4058. // Marker that is used to determine whether the user has added a theme to their page.
  4059. @at-root {
  4060. .mat-theme-loaded-marker {
  4061. display: none;
  4062. }
  4063. }
  4064. }
  4065. @mixin mat-divider-theme($theme) {
  4066. $foreground: map-get($theme, foreground);
  4067. .mat-divider {
  4068. border-top-color: mat-color($foreground, divider);
  4069. }
  4070. .mat-divider-vertical {
  4071. border-right-color: mat-color($foreground, divider);
  4072. }
  4073. }
  4074. // Create a theme.
  4075. @mixin angular-material-theme($theme) {
  4076. @include mat-core-theme($theme);
  4077. @include mat-autocomplete-theme($theme);
  4078. @include mat-badge-theme($theme);
  4079. @include mat-bottom-sheet-theme($theme);
  4080. @include mat-button-theme($theme);
  4081. @include mat-button-toggle-theme($theme);
  4082. @include mat-card-theme($theme);
  4083. @include mat-checkbox-theme($theme);
  4084. @include mat-chips-theme($theme);
  4085. @include mat-table-theme($theme);
  4086. @include mat-datepicker-theme($theme);
  4087. @include mat-dialog-theme($theme);
  4088. @include mat-divider-theme($theme);
  4089. @include mat-expansion-panel-theme($theme);
  4090. @include mat-form-field-theme($theme);
  4091. @include mat-grid-list-theme($theme);
  4092. @include mat-icon-theme($theme);
  4093. @include mat-input-theme($theme);
  4094. @include mat-list-theme($theme);
  4095. @include mat-menu-theme($theme);
  4096. @include mat-paginator-theme($theme);
  4097. @include mat-progress-bar-theme($theme);
  4098. @include mat-progress-spinner-theme($theme);
  4099. @include mat-radio-theme($theme);
  4100. @include mat-select-theme($theme);
  4101. @include mat-sidenav-theme($theme);
  4102. @include mat-slide-toggle-theme($theme);
  4103. @include mat-slider-theme($theme);
  4104. @include mat-stepper-theme($theme);
  4105. @include mat-sort-theme($theme);
  4106. @include mat-tabs-theme($theme);
  4107. @include mat-toolbar-theme($theme);
  4108. @include mat-tooltip-theme($theme);
  4109. @include mat-tree-theme($theme);
  4110. @include mat-snack-bar-theme($theme);
  4111. }